From 717ca8ae625108fbce3eef0d38d8addaaa74e932 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Tue, 7 Apr 2026 13:25:52 +0300 Subject: [PATCH] Fix warnings --- src/3proxy.c | 6 +++--- src/conf.c | 17 +++++++++-------- src/plugins/StringsPlugin/StringsPlugin.c | 4 ++-- src/webadmin.c | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/3proxy.c b/src/3proxy.c index e903dff..67f5cde 100644 --- a/src/3proxy.c +++ b/src/3proxy.c @@ -215,7 +215,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){ cheader.updated = conf.time; lseek(counterd, 0, SEEK_SET); - write(counterd, &cheader, sizeof(struct counter_header)); + if(write(counterd, &cheader, sizeof(struct counter_header))){} for(tl=tlin; tl; tl = tl->next){ if(tl->number){ lseek(counterd, @@ -224,7 +224,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){ crecord.traf64 = tl->traf64; crecord.cleared = tl->cleared; crecord.updated = tl->updated; - write(counterd, &crecord, sizeof(struct counter_record)); + if(write(counterd, &crecord, sizeof(struct counter_record))){} } if(tl->type!=NEVER && timechanged(tl->cleared, conf.time, tl->type)){ tl->cleared = conf.time; @@ -315,7 +315,7 @@ void cyclestep(void){ else strcat((char *)tmpbuf, (char *)conf.archiver[i]); } - system((char *)tmpbuf+1); + if(system((char *)tmpbuf+1)){} } } } diff --git a/src/conf.c b/src/conf.c index ae981be..e9f3b61 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1348,13 +1348,14 @@ static int h_ace(int argc, unsigned char **argv){ sizeof(struct counter_header) + (tl->number - 1) * sizeof(struct counter_record), SEEK_SET); memset(&crecord, 0, sizeof(struct counter_record)); - read(conf.counterd, &crecord, sizeof(struct counter_record)); - tl->traf64 = crecord.traf64; - tl->cleared = crecord.cleared; - tl->updated = crecord.updated; - if(tl->cleared < 0 || tl->cleared >= MAX_COUNTER_TIME || tl->updated < 0 || tl->updated >= MAX_COUNTER_TIME){ - fprintf(stderr, "Invalid, incompatible or corrupted counter file.\n"); - return(6); + if(read(conf.counterd, &crecord, sizeof(struct counter_record)) == sizeof(struct counter_record)){ + tl->traf64 = crecord.traf64; + tl->cleared = crecord.cleared; + tl->updated = crecord.updated; + if(tl->cleared < 0 || tl->cleared >= MAX_COUNTER_TIME || tl->updated < 0 || tl->updated >= MAX_COUNTER_TIME){ + fprintf(stderr, "Invalid, incompatible or corrupted counter file.\n"); + return(6); + } } } } @@ -1575,7 +1576,7 @@ static int h_chroot(int argc, unsigned char **argv){ fprintf(stderr, "Unable to set uid %d", (int)uid); return(5); } - chdir("/"); + if(chdir("/")){} return 0; } #endif diff --git a/src/plugins/StringsPlugin/StringsPlugin.c b/src/plugins/StringsPlugin/StringsPlugin.c index e97098d..ccc8705 100644 --- a/src/plugins/StringsPlugin/StringsPlugin.c +++ b/src/plugins/StringsPlugin/StringsPlugin.c @@ -32,7 +32,7 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr, /*find start service section*/ while(!feof(f)) { - fgets(tmpbuf1, 1023,f); + if(!fgets(tmpbuf1, 1023,f)) return NULL; if ((strstr(tmpbuf1,start))!=NULL) { i++; break; } tmpbuf1[0]='\0'; } @@ -51,7 +51,7 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr, i=0; while ( !feof(f) || i< max_count_str) { - fgets(tmpbuf1, 1023,f); + if(!fgets(tmpbuf1, 1023,f)) return NULL; if ((strstr(tmpbuf1,stop))!=NULL) { break; } diff --git a/src/webadmin.c b/src/webadmin.c index b3548bf..cf51eea 100644 --- a/src/webadmin.c +++ b/src/webadmin.c @@ -593,7 +593,7 @@ void * adminchild(struct clientparam* param) { if(writable && !error){ fflush(writable); #ifndef _WINCE - ftruncate(fileno(writable), ftell(writable)); + if(ftruncate(fileno(writable), ftell(writable))){} #endif } printstr(&pp, error? "