Fix compilation with gcc 4.3 and glibc 2.8.90.
authorMichael Poole <mdpoole@troilus.org>
Sat, 3 Jan 2009 19:56:39 +0000 (14:56 -0500)
committerMichael Poole <mdpoole@troilus.org>
Sat, 3 Jan 2009 19:56:39 +0000 (14:56 -0500)
src/mod-helpserv.c (create_request): Use explicit format strings for
  sprintf() when no format argument is passed.
src/modcmd.c: Store the result of strtoul() into a variable.
src/nickserv.c: Pay attention to the return value of fgets().

src/mod-helpserv.c
src/modcmd.c
src/nickserv.c

index dfb95b60b84b55d6967f53bfe0868b9735d1e30c..693738b3ce78515f8356476f51a338d7e2653810 100644 (file)
@@ -955,7 +955,7 @@ static struct helpserv_request * create_request(struct userNode *user, struct he
         sprintf(lbuf[1], fmt, unh);
     } else {
         fmt = user_find_message(user, "HSMSG_REQ_NO_UNHANDLED");
-        sprintf(lbuf[1], fmt);
+        sprintf(lbuf[1], "%s", fmt);
     }
     switch (hs->persist_types[PERSIST_T_REQUEST]) {
         case PERSIST_PART:
@@ -964,18 +964,17 @@ static struct helpserv_request * create_request(struct userNode *user, struct he
             break;
         case PERSIST_QUIT:
             fmt = user_find_message(user, "HSMSG_REQ_PERSIST_QUIT");
-            sprintf(lbuf[2], fmt);
+            sprintf(lbuf[2], "%s", fmt);
             break;
         default:
             log_module(HS_LOG, LOG_ERROR, "%s has an invalid req_persist.", hs->helpserv->nick);
         case PERSIST_CLOSE:
             if (user->handle_info) {
                 fmt = user_find_message(user, "HSMSG_REQ_PERSIST_HANDLE");
-                sprintf(lbuf[2], fmt);
             } else {
                 fmt = user_find_message(user, "HSMSG_REQ_PERSIST_QUIT");
-                sprintf(lbuf[2], fmt);
             }
+            sprintf(lbuf[2], "%s", fmt);
             break;
     }
     helpserv_message(hs, user, MSGTYPE_REQ_OPENED);
index 2598943b08710a20e71a55e609445029bf44826b..da6826a71d88042c561195261f784fa3751f5623 100644 (file)
@@ -990,8 +990,9 @@ check_alias_args(char *argv[], unsigned int argc) {
             continue;
         } else if (isdigit(argv[arg][1])) {
             char *end_num;
+            unsigned long arg;
 
-            strtoul(argv[arg]+1, &end_num, 10);
+            arg = strtoul(argv[arg]+1, &end_num, 10);
             switch (end_num[0]) {
             case 0:
                 continue;
index 6a2ca5757e0b5c406d8be9a0b76cb7975e67bdeb..424150f5d76763b6c418b0f0d202bc4c511e549d 100644 (file)
@@ -3728,8 +3728,7 @@ nickserv_load_dict(const char *fname)
         log_module(NS_LOG, LOG_ERROR, "Unable to open dictionary file %s: %s", fname, strerror(errno));
         return;
     }
-    while (!feof(file)) {
-        fgets(line, sizeof(line), file);
+    while (fgets(line, sizeof(line), file)) {
         if (!line[0])
             continue;
         if (line[strlen(line)-1] == '\n')