--- rawlog.c 2012-01-09 20:31:52.821352486 +0100 +++ rawlog.c 2012-01-09 22:32:48.218647541 +0100 @@ -565,20 +565,25 @@ ** compressed raw file to be decompressed via gunzip */ fprintf(stderr, "Decompressing logfile ....\n"); + snprintf(tmpname2, sizeof tmpname2, "/tmp/atopwrkXXXXXX"); + rawfd = mkstemp(tmpname2); + if (rawfd == -1) + { + fprintf(stderr, "%s - ", rawname); + perror("creating decompression temp file"); + cleanstop(7); + } - snprintf(tmpname2, sizeof tmpname2, "/tmp/atopwrk%d", getpid()); snprintf(command, sizeof command, "gunzip -c %s > %s", tmpname1, tmpname2); - system (command); + const int system_res = system (command); + unlink(tmpname2); - if ( (rawfd = open(tmpname2, O_RDONLY)) == -1) + if (system_res) { - fprintf(stderr, "%s - ", rawname); - perror("open decompressed raw file"); + fprintf(stderr, "%s - gunzip failed", rawname); cleanstop(7); } - - unlink(tmpname2); } /*