Investigated and fixed up more compiler warnings. Now builds clean on gcc7.3

This commit is contained in:
MadCamel 2018-04-14 10:24:41 -04:00
parent cc752e9ccd
commit 2f910d1725
4 changed files with 20 additions and 9 deletions

View File

@ -476,7 +476,8 @@ void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode,
{ {
if ((Strlen2(deopstring,burst)) >= MSGLEN-2) // burst is never NULL if ((Strlen2(deopstring,burst)) >= MSGLEN-2) // burst is never NULL
{ {
write(current->sock,burst,strlen(burst)); if (write(current->sock,burst,strlen(burst)) == -1)
return;
#ifdef DEBUG #ifdef DEBUG
debug("(channel_massmode)\n%s\n",burst); debug("(channel_massmode)\n%s\n",burst);
#endif /* DEBUG */ #endif /* DEBUG */
@ -489,7 +490,8 @@ void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode,
if (strlen(burst)) if (strlen(burst))
{ {
write(current->sock,burst,strlen(burst)); if (write(current->sock,burst,strlen(burst)) == -1)
return;
#ifdef DEBUG #ifdef DEBUG
debug("(...)\n%s\n",burst); debug("(...)\n%s\n",burst);
#endif /* DEBUG */ #endif /* DEBUG */

View File

@ -152,7 +152,7 @@ void dcc_pushfile(Client *client, off_t where)
sz = read(client->fileno,tempdata,sz); sz = read(client->fileno,tempdata,sz);
if (sz < 1) if (sz < 1)
return; return;
write(client->sock,tempdata,sz); sz = write(client->sock,tempdata,sz);
} }
int dcc_freeslots(int uaccess) int dcc_freeslots(int uaccess)
@ -235,7 +235,8 @@ void parse_dcc(Client *client)
{ {
s = read(client->sock,bigtemp,4096); s = read(client->sock,bigtemp,4096);
if (s > 0) if (s > 0)
write(client->fileno,bigtemp,s); if (write(client->fileno,bigtemp,s) == -1)
return;
} }
while(s > 0); while(s > 0);
@ -244,7 +245,10 @@ void parse_dcc(Client *client)
where = oc = lseek(client->fileno,0,SEEK_CUR); where = oc = lseek(client->fileno,0,SEEK_CUR);
where = htonl(where); where = htonl(where);
write(client->sock,&where,4);
if (write(client->sock,&where,4) == -1)
return;
client->lasttime = now; client->lasttime = now;
if (oc == client->fileend) if (oc == client->fileend)

View File

@ -299,7 +299,9 @@ void send_redirect(char *message)
if ((fd = open(redirect.to,O_WRONLY|O_CREAT|O_APPEND,NEWFILEMODE)) < 0) if ((fd = open(redirect.to,O_WRONLY|O_CREAT|O_APPEND,NEWFILEMODE)) < 0)
return; return;
fmt = stringcat(message,"\n"); fmt = stringcat(message,"\n");
write(fd,message,(fmt-message)); if (write(fd,message,(fmt-message)) == -1)
return;
close(fd); close(fd);
return; return;
#ifdef BOTNET #ifdef BOTNET
@ -936,7 +938,7 @@ void do_info(COMMAND_ARGS)
{ {
avg = (stats->userpeak + stats->userlow) / 2; avg = (stats->userpeak + stats->userlow) / 2;
} }
sprintf(p,"%-7lu %-4i %i",avg,stats->userpeak,stats->userlow); sprintf(p,"%-7u %-4i %i",avg,stats->userpeak,stats->userlow);
to_user(from,FMT_PLAIN,text); to_user(from,FMT_PLAIN,text);
sprintf(text,"Messages: %i Notices: %i Joins: %i Parts: %i Kicks: %i Quits: %i", sprintf(text,"Messages: %i Notices: %i Joins: %i Parts: %i Kicks: %i Quits: %i",
stats->privmsg,stats->notice,stats->joins,stats->parts,stats->kicks,stats->quits); stats->privmsg,stats->notice,stats->joins,stats->parts,stats->kicks,stats->quits);

View File

@ -365,10 +365,13 @@ char *random_question(char *triv_rand)
n--; n--;
lseek(ifd,(n * sizeof(entry)),SEEK_SET); lseek(ifd,(n * sizeof(entry)),SEEK_SET);
read(ifd,&entry,sizeof(entry)); if (read(ifd,&entry,sizeof(entry)) == -1)
return(NULL);
lseek(fd,entry.off,SEEK_SET); lseek(fd,entry.off,SEEK_SET);
read(fd,triv_rand,entry.sz); if (read(fd,triv_rand,entry.sz) == -1)
return(NULL);
triv_rand[entry.sz] = 0; triv_rand[entry.sz] = 0;
close(fd); close(fd);