Use vfork only on BSD systems, and union wait only on BSD systems
authorJohn Carr <jfc@mit.edu>
Tue, 11 Feb 1992 03:19:24 +0000 (03:19 +0000)
committerJohn Carr <jfc@mit.edu>
Tue, 11 Feb 1992 03:19:24 +0000 (03:19 +0000)
prior to 4.3 Reno.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2204 dc483132-0cff-0310-8789-dd5450dbe970

src/slave/kpropd.c

index 934801adffcd34e64bc202d8a1a190d4fd29d11c..31ec869b5c54627983b5885b8ca87a3780d64f08 100644 (file)
@@ -803,7 +803,17 @@ load_database(kdb5_edit, database_file_name)
 {
        static char     *edit_av[4];
        int     error_ret, save_stderr;
+
+       /* <sys/param.h> has been included, so BSD will be defined on
+          BSD systems */
+#if BSD > 0 && BSD <= 43
+#ifndef WEXITSTATUS
+#define        WEXITSTATUS(w) (w).w_retcode
+#endif
        union wait      waitb;
+#else
+       int     waitb;
+#endif
        char    request[1024];
        krb5_error_code retval;
 
@@ -816,6 +826,10 @@ load_database(kdb5_edit, database_file_name)
        edit_av[1] = "-R";      
        edit_av[2] = request;
        edit_av[3] = NULL;
+
+#ifndef BSD
+#define        vfork fork
+#endif
        switch(vfork()) {
        case -1:
                com_err(progname, errno, "while trying to fork %s",
@@ -848,7 +862,7 @@ load_database(kdb5_edit, database_file_name)
                }
        }
        
-       if (error_ret = waitb.w_retcode) {
+       if (error_ret = WEXITSTATUS(waitb)) {
                com_err(progname, 0, "%s returned a bad exit status (%d)",
                        kdb5_edit, error_ret);
                exit(1);