Date:        Tue, 8 Mar 2016 11:48:01 -0800
    From:        bch <[email protected]>
    Message-ID:  
<CABfrOT9HuV3Ncz9q7_4bX=5drvPc=7a13tromdu4cgu2c5f...@mail.gmail.com>

  | postinstall-check ===> .        (with: DESTDIR=/)
  | sh: PPID: is read only
  | nbmake[1]: "/usr/src/share/mk/bsd.own.mk" line 1284: warning: "cd
  | "/usr/src/../xsrc" && pwd" returned non-zero status

The following patch is needed to src/bin/sh/var.c - this should fix that
problem.

kre

--- var.c       2016-03-09 02:21:21.000000000 +0700
+++ var.c.fixed 2016-03-09 05:32:17.000000000 +0700
@@ -41,7 +41,6 @@
 #endif
 #endif /* not lint */
 
-#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
@@ -148,10 +147,13 @@
  */
 
 #ifdef mkinit
+INCLUDE <stdio.h>
+INCLUDE <unistd.h>
 INCLUDE "var.h"
 MKINIT char **environ;
 INIT {
        char **envp;
+       char buf[64];
 
        initvar();
        for (envp = environ ; *envp ; envp++) {
@@ -159,6 +161,14 @@
                        setvareq(*envp, VEXPORT|VTEXTFIXED);
                }
        }
+
+
+       /*
+        * PPID is readonly
+        *      set after processing environ to override anything there
+        */
+       snprintf(buf, sizeof(buf), "%d", (int)getppid());
+       setvar("PPID", buf, VREADONLY);
 }
 #endif
 
@@ -174,7 +184,6 @@
        const struct varinit *ip;
        struct var *vp;
        struct var **vpp;
-       char buf[64];
 
        for (ip = varinit ; (vp = ip->var) != NULL ; ip++) {
                if (find_var(ip->text, &vpp, &vp->name_len) != NULL)
@@ -195,12 +204,6 @@
                vps1.text = NULL;
                choose_ps1();
        }
-
-       /*
-        * PPID is readonly
-        */
-       snprintf(buf, sizeof(buf), "%d", (int)getppid());
-       setvar("PPID", buf, VREADONLY);
 }
 
 void


Reply via email to