mirror of
https://github.com/3proxy/3proxy.git
synced 2025-06-08 12:34:48 +08:00
Changes to remove gcc warnings under linux
This commit is contained in:
parent
f53b0eb985
commit
8735cf1b4a
10
src/3proxy.c
10
src/3proxy.c
@ -199,6 +199,8 @@ void dumpcounters(struct trafcount *tlin, int counterd){
|
||||
|
||||
unsigned char tmpbuf[8192];
|
||||
struct trafcount *tl;
|
||||
ssize_t len;
|
||||
|
||||
if(counterd >= 0 && tlin) {
|
||||
|
||||
conf.time = time(0);
|
||||
@ -218,7 +220,8 @@ void dumpcounters(struct trafcount *tlin, int counterd){
|
||||
|
||||
cheader.updated = conf.time;
|
||||
lseek(counterd, 0, SEEK_SET);
|
||||
write(counterd, &cheader, sizeof(struct counter_header));
|
||||
len = write(counterd, &cheader, sizeof(struct counter_header));
|
||||
if (len != sizeof(struct counter_header)) fprintf(stderr, "%s error: written %ld bytes\n", __func__, len);
|
||||
for(tl=tlin; tl; tl = tl->next){
|
||||
if(tl->number){
|
||||
lseek(counterd,
|
||||
@ -227,7 +230,8 @@ 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));
|
||||
len = write(counterd, &crecord, sizeof(struct counter_record));
|
||||
if (len != sizeof(struct counter_header)) fprintf(stderr, "%s error: written %ld bytes\n", __func__, len);
|
||||
}
|
||||
if(tl->type!=NEVER && timechanged(tl->cleared, conf.time, tl->type)){
|
||||
tl->cleared = conf.time;
|
||||
@ -318,7 +322,7 @@ void cyclestep(void){
|
||||
else
|
||||
strcat((char *)tmpbuf, (char *)conf.archiver[i]);
|
||||
}
|
||||
system((char *)tmpbuf+1);
|
||||
if (system((char *)tmpbuf+1)==-1) fprintf(stderr, "%s: some error in system() call\n", __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1274,6 +1274,7 @@ static int h_ace(int argc, unsigned char **argv){
|
||||
|
||||
if((acl->action == COUNTIN)||(acl->action == COUNTOUT)||(acl->action == COUNTALL)) {
|
||||
unsigned long lim;
|
||||
ssize_t len;
|
||||
|
||||
tl->comment = ( char *)argv[1];
|
||||
while(isdigit(*tl->comment))tl->comment++;
|
||||
@ -1295,7 +1296,8 @@ 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));
|
||||
len = read(conf.counterd, &crecord, sizeof(struct counter_record));
|
||||
if (len<sizeof(struct counter_record)) fprintf(stderr, "Error: read %ld bytes insread of %lu\n", len, sizeof(struct counter_record));
|
||||
tl->traf64 = crecord.traf64;
|
||||
tl->cleared = crecord.cleared;
|
||||
tl->updated = crecord.updated;
|
||||
@ -1522,7 +1524,10 @@ static int h_chroot(int argc, unsigned char **argv){
|
||||
fprintf(stderr, "Unable to set uid %d", (int)uid);
|
||||
return(5);
|
||||
}
|
||||
chdir("/");
|
||||
if (chdir("/")!=0) {
|
||||
fprintf(stderr, "Unable to chdir /");
|
||||
return(6);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -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)) break;
|
||||
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)) break;
|
||||
|
||||
if ((strstr(tmpbuf1,stop))!=NULL) { break; }
|
||||
|
||||
|
@ -16,8 +16,12 @@
|
||||
#include <sys/stat.h>
|
||||
#include <stdint.h>
|
||||
#ifndef PRINTF_INT64_MODIFIER
|
||||
#if __WORDSIZE == 64
|
||||
#define PRINTF_INT64_MODIFIER "l"
|
||||
#else
|
||||
#define PRINTF_INT64_MODIFIER "ll"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -711,7 +715,7 @@ struct sockfuncs {
|
||||
int (*_getsockname)(SOCKET s, struct sockaddr * name, socklen_t * namelen);
|
||||
int (*_getsockopt)(SOCKET s, int level, int optname, void * optval, socklen_t * optlen);
|
||||
int (*_setsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen);
|
||||
int (*_poll)(struct pollfd *fds, unsigned int nfds, int timeout);
|
||||
int (*_poll)(struct pollfd *fds, nfds_t, int timeout);
|
||||
size_t (*_send)(SOCKET s, const void *msg, size_t len, int flags);
|
||||
size_t (*_sendto)(SOCKET s, const void *msg, size_t len, int flags, const struct sockaddr *to, SASIZETYPE tolen);
|
||||
size_t (*_recv)(SOCKET s, void *buf, size_t len, int flags);
|
||||
|
@ -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))!=0) perror("Failed to truncate");
|
||||
#endif
|
||||
}
|
||||
printstr(&pp, error? "<h3><font color=\"red\">Config file is not writable</font></h3>Make sure you have \"writable\" command in configuration file":
|
||||
|
Loading…
Reference in New Issue
Block a user