X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/e30f065766d103b47aaccbe777308e0d2381fd6e..64c2cf8fea3287b7f1b4ce2a359dfaf0e2da0ad8:/socket.c diff --git a/socket.c b/socket.c index 9a619515..b4d078cd 100644 --- a/socket.c +++ b/socket.c @@ -247,6 +247,11 @@ void start_accept_loop(int port, int (*fn)(int )) struct sockaddr addr; int in_addrlen = sizeof(addr); + /* close log file before the potentially very long select so + file can be trimmed by another process instead of growing + forever */ + log_close(); + FD_ZERO(&fds); FD_SET(s, &fds); @@ -272,6 +277,10 @@ void start_accept_loop(int port, int (*fn)(int )) if (fork()==0) { close(s); + /* open log file in child before possibly giving + up privileges */ + log_open(); + _exit(fn(fd)); }