Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.bin/newsyslog Apply patch (approved by thorpej):



details:   https://anonhg.NetBSD.org/src/rev/4be86d48e184
branches:  netbsd-1-5
changeset: 489723:4be86d48e184
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Oct 09 11:08:29 2000 +0000

description:
Apply patch (approved by thorpej):
  Wait for gzip to complete.

diffstat:

 usr.bin/newsyslog/newsyslog.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 7d5492d784da -r 4be86d48e184 usr.bin/newsyslog/newsyslog.c
--- a/usr.bin/newsyslog/newsyslog.c     Mon Oct 09 04:46:00 2000 +0000
+++ b/usr.bin/newsyslog/newsyslog.c     Mon Oct 09 11:08:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: newsyslog.c,v 1.21 1999/11/30 12:03:24 ad Exp $        */
+/*     $NetBSD: newsyslog.c,v 1.21.4.1 2000/10/09 11:08:29 ad Exp $    */
 
 /*
  * This file contains changes from the Open Software Foundation.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: newsyslog.c,v 1.21 1999/11/30 12:03:24 ad Exp $");
+__RCSID("$NetBSD: newsyslog.c,v 1.21.4.1 2000/10/09 11:08:29 ad Exp $");
 #endif /* not lint */
 
 #ifndef CONF
@@ -577,13 +577,14 @@
         char    *log;
 {
         int     pid;
+        int     status;
         char    tmp[128];
         
-        pid = fork();
         (void) sprintf(tmp,"%s.0",log);
+        pid = vfork();
         if (pid < 0) {
                 fprintf(stderr,"%s: ",progname);
-                perror("fork");
+                perror("vfork");
                 exit(1);
         } else if (!pid) {
                 (void) execl(COMPRESS,"compress","-f",tmp,0);
@@ -591,6 +592,14 @@
                 perror(COMPRESS);
                 exit(1);
         }
+
+       while (waitpid(pid, &status, 0) != pid)
+               ;
+
+       if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
+               fprintf(stderr,"%s: ",progname);
+               perror(COMPRESS);
+       }
 }
 
 /* Return size in kilobytes of a file */



Home | Main Index | Thread Index | Old Index