]> arthur.barton.de Git - ngircd.git/commitdiff
Fix two K&R C portability issues
authorAlexander Barton <alex@barton.de>
Sun, 16 Mar 2014 19:07:08 +0000 (20:07 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 19 Mar 2014 01:30:22 +0000 (02:30 +0100)
Fix the following two errors emitted by the Apple K&R C compiler
on Apple A/UX:

"./class.c", line 47: no automatic aggregate initialization
"./class.c", line 47: illegal lhs of assignment operator

"./conf.c", line 1052: syntax error

Tested on A/UX 3.1.1.

(cherry picked from commit a4ed90ba9af1dce4df3f57f6a7c84097000c7256)

src/ngircd/class.c
src/ngircd/conf.c

index b2b1aa357c13a9470e29076a43406bef1fa70461..d08f4c565001062d6f5e18b515644f9634c56769 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -50,11 +50,13 @@ Class_Exit(void)
 GLOBAL bool
 Class_GetMemberReason(const int Class, CLIENT *Client, char *reason, size_t len)
 {
-       char str[COMMAND_LEN] = "listed";
+       char str[COMMAND_LEN];
 
        assert(Class < CLASS_COUNT);
        assert(Client != NULL);
 
+       strlcpy(str, "listed", sizeof(str));
+
        if (!Lists_CheckReason(&My_Classes[Class], Client, str, sizeof(str)))
                return false;
 
index 16275877a8d9e95f37cbf57ac1b395d55bb86d78..940ab2f9d835c8a0372eaadf9b95e7e6422de35f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1052,9 +1052,13 @@ Read_Config(bool TestOnly, bool IsStarting)
 }
 
 /**
- * ...
+ * Read in and handle a configuration file.
+ *
+ * @param File Name of the configuration file.
+ * @param fd File descriptor already opened for reading.
  */
-static void Read_Config_File(const char *File, FILE *fd)
+static void
+Read_Config_File(const char *File, FILE *fd)
 {
        char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
        int i, line = 0;