Fix warnings

This commit is contained in:
Vladimir Dubrovin 2026-04-07 13:25:52 +03:00
parent 49a61affb7
commit 717ca8ae62
4 changed files with 15 additions and 14 deletions

View File

@ -215,7 +215,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){
cheader.updated = conf.time; cheader.updated = conf.time;
lseek(counterd, 0, SEEK_SET); 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){ for(tl=tlin; tl; tl = tl->next){
if(tl->number){ if(tl->number){
lseek(counterd, lseek(counterd,
@ -224,7 +224,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){
crecord.traf64 = tl->traf64; crecord.traf64 = tl->traf64;
crecord.cleared = tl->cleared; crecord.cleared = tl->cleared;
crecord.updated = tl->updated; 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)){ if(tl->type!=NEVER && timechanged(tl->cleared, conf.time, tl->type)){
tl->cleared = conf.time; tl->cleared = conf.time;
@ -315,7 +315,7 @@ void cyclestep(void){
else else
strcat((char *)tmpbuf, (char *)conf.archiver[i]); strcat((char *)tmpbuf, (char *)conf.archiver[i]);
} }
system((char *)tmpbuf+1); if(system((char *)tmpbuf+1)){}
} }
} }
} }

View File

@ -1348,7 +1348,7 @@ static int h_ace(int argc, unsigned char **argv){
sizeof(struct counter_header) + (tl->number - 1) * sizeof(struct counter_record), sizeof(struct counter_header) + (tl->number - 1) * sizeof(struct counter_record),
SEEK_SET); SEEK_SET);
memset(&crecord, 0, sizeof(struct counter_record)); memset(&crecord, 0, sizeof(struct counter_record));
read(conf.counterd, &crecord, sizeof(struct counter_record)); if(read(conf.counterd, &crecord, sizeof(struct counter_record)) == sizeof(struct counter_record)){
tl->traf64 = crecord.traf64; tl->traf64 = crecord.traf64;
tl->cleared = crecord.cleared; tl->cleared = crecord.cleared;
tl->updated = crecord.updated; tl->updated = crecord.updated;
@ -1358,6 +1358,7 @@ static int h_ace(int argc, unsigned char **argv){
} }
} }
} }
}
pthread_mutex_lock(&tc_mutex); pthread_mutex_lock(&tc_mutex);
if(!conf.trafcounter){ if(!conf.trafcounter){
conf.trafcounter = tl; conf.trafcounter = tl;
@ -1575,7 +1576,7 @@ static int h_chroot(int argc, unsigned char **argv){
fprintf(stderr, "Unable to set uid %d", (int)uid); fprintf(stderr, "Unable to set uid %d", (int)uid);
return(5); return(5);
} }
chdir("/"); if(chdir("/")){}
return 0; return 0;
} }
#endif #endif

View File

@ -32,7 +32,7 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr,
/*find start service section*/ /*find start service section*/
while(!feof(f)) while(!feof(f))
{ {
fgets(tmpbuf1, 1023,f); if(!fgets(tmpbuf1, 1023,f)) return NULL;
if ((strstr(tmpbuf1,start))!=NULL) { i++; break; } if ((strstr(tmpbuf1,start))!=NULL) { i++; break; }
tmpbuf1[0]='\0'; tmpbuf1[0]='\0';
} }
@ -51,7 +51,7 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr,
i=0; i=0;
while ( !feof(f) || i< max_count_str) while ( !feof(f) || i< max_count_str)
{ {
fgets(tmpbuf1, 1023,f); if(!fgets(tmpbuf1, 1023,f)) return NULL;
if ((strstr(tmpbuf1,stop))!=NULL) { break; } if ((strstr(tmpbuf1,stop))!=NULL) { break; }

View File

@ -593,7 +593,7 @@ void * adminchild(struct clientparam* param) {
if(writable && !error){ if(writable && !error){
fflush(writable); fflush(writable);
#ifndef _WINCE #ifndef _WINCE
ftruncate(fileno(writable), ftell(writable)); if(ftruncate(fileno(writable), ftell(writable))){}
#endif #endif
} }
printstr(&pp, error? "<h3><font color=\"red\">Config file is not writable</font></h3>Make sure you have \"writable\" command in configuration file": printstr(&pp, error? "<h3><font color=\"red\">Config file is not writable</font></h3>Make sure you have \"writable\" command in configuration file":