diff --git a/src/channel.c b/src/channel.c index 230d728..2a15427 100644 --- a/src/channel.c +++ b/src/channel.c @@ -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 { - write(current->sock,burst,strlen(burst)); + if (write(current->sock,burst,strlen(burst)) == -1) + return; #ifdef DEBUG debug("(channel_massmode)\n%s\n",burst); #endif /* DEBUG */ @@ -489,7 +490,8 @@ void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode, if (strlen(burst)) { - write(current->sock,burst,strlen(burst)); + if (write(current->sock,burst,strlen(burst)) == -1) + return; #ifdef DEBUG debug("(...)\n%s\n",burst); #endif /* DEBUG */ diff --git a/src/ctcp.c b/src/ctcp.c index 76fd87e..c01bb96 100644 --- a/src/ctcp.c +++ b/src/ctcp.c @@ -152,7 +152,7 @@ void dcc_pushfile(Client *client, off_t where) sz = read(client->fileno,tempdata,sz); if (sz < 1) return; - write(client->sock,tempdata,sz); + sz = write(client->sock,tempdata,sz); } int dcc_freeslots(int uaccess) @@ -235,7 +235,8 @@ void parse_dcc(Client *client) { s = read(client->sock,bigtemp,4096); if (s > 0) - write(client->fileno,bigtemp,s); + if (write(client->fileno,bigtemp,s) == -1) + return; } while(s > 0); @@ -244,7 +245,10 @@ void parse_dcc(Client *client) where = oc = lseek(client->fileno,0,SEEK_CUR); where = htonl(where); - write(client->sock,&where,4); + + if (write(client->sock,&where,4) == -1) + return; + client->lasttime = now; if (oc == client->fileend) diff --git a/src/spy.c b/src/spy.c index 43143a7..e6d1ae5 100644 --- a/src/spy.c +++ b/src/spy.c @@ -299,7 +299,9 @@ void send_redirect(char *message) if ((fd = open(redirect.to,O_WRONLY|O_CREAT|O_APPEND,NEWFILEMODE)) < 0) return; fmt = stringcat(message,"\n"); - write(fd,message,(fmt-message)); + if (write(fd,message,(fmt-message)) == -1) + return; + close(fd); return; #ifdef BOTNET @@ -936,7 +938,7 @@ void do_info(COMMAND_ARGS) { 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); 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); diff --git a/src/trivia.c b/src/trivia.c index 477f814..d04a6b8 100644 --- a/src/trivia.c +++ b/src/trivia.c @@ -365,10 +365,13 @@ char *random_question(char *triv_rand) n--; 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); - read(fd,triv_rand,entry.sz); + if (read(fd,triv_rand,entry.sz) == -1) + return(NULL); + triv_rand[entry.sz] = 0; close(fd);