From fe31be6543a6004cb6fbf3554d286e4f4f93a9b8 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Sat, 3 Jan 2009 14:56:39 -0500 Subject: [PATCH] Fix compilation with gcc 4.3 and glibc 2.8.90. 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 | 7 +++---- src/modcmd.c | 3 ++- src/nickserv.c | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index dfb95b6..693738b 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -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); diff --git a/src/modcmd.c b/src/modcmd.c index 2598943..da6826a 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -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; diff --git a/src/nickserv.c b/src/nickserv.c index 6a2ca57..424150f 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -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') -- 2.20.1