From: Francesco Chemolli Date: Fri, 20 Aug 2010 11:29:35 +0000 (+0200) Subject: Fixed some build errors in purge tool. X-Git-Tag: take1~356 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec3c3187987682b6b4c87f53ad10dc5e44577ddc;p=thirdparty%2Fsquid.git Fixed some build errors in purge tool. --- diff --git a/tools/purge/copyout.cc b/tools/purge/copyout.cc index b12f11b3ab..eb4987dd34 100644 --- a/tools/purge/copyout.cc +++ b/tools/purge/copyout.cc @@ -234,12 +234,14 @@ copy_out( size_t filesize, size_t metasize, unsigned debug, // seek end of output file ... off_t position = lseek( out, filesize-metasize-1, SEEK_SET ); if ( position == -1 ) { - fprintf( stderr, "lseek(%s,%lu): %s\n", filename, filesize-metasize, + fprintf( stderr, "lseek(%s,%lu): %s\n", filename, + (unsigned long)filesize-metasize, strerror(errno) ); BAUTZ(false); } else if ( debug & 0x02 ) { fprintf( stderr, "# filesize=%lu, metasize=%lu, filepos=%ld\n", - filesize, metasize, position ); + (unsigned long)filesize, (unsigned long)metasize, + (long)position ); } // ...and write 1 byte there (create a file that length) diff --git a/tools/purge/signal.cc b/tools/purge/signal.cc index ee2411e204..10f1c2ab3b 100644 --- a/tools/purge/signal.cc +++ b/tools/purge/signal.cc @@ -110,15 +110,14 @@ sigChild( int signo ) { pid_t pid; int status = signo; // to stop GNU from complaining... - char line[128]; int saveerr = errno; while ( (pid = waitpid( -1, &status, WNOHANG )) > 0 ) { if ( WIFEXITED(status) ) { - snprintf( line, 128, "child (pid=%ld) reaped, status %d\n%c", + fprintf( stderr, "child (pid=%ld) reaped, status %d\n%c", (long) pid, WEXITSTATUS(status), 0 ); } else if ( WIFSIGNALED(status) ) { - snprintf( line, 128, "child (pid=%ld) died on signal %d%s\n%c", + fprintf( stderr, "child (pid=%ld) died on signal %d%s\n%c", (long) pid, WTERMSIG(status), #ifdef WCOREDUMP WCOREDUMP(status) ? " (core generated)" : "", @@ -127,10 +126,9 @@ sigChild( int signo ) #endif 0 ); } else { - snprintf( line, 128, "detected dead child (pid=%ld), status %d\n%c", + fprintf( stderr, "detected dead child (pid=%ld), status %d\n%c", (long) pid, status, 0 ); } - write( STDERR_FILENO, line, strlen(line) ); } errno = saveerr;