#! /bin/sh /usr/share/dpatch/dpatch-run ## 64_init_set_PATH.dpatch by Thomas Hood ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Set PATH to a sane value if it is unset on re-exec. ## DP: Use setenv() instead of putenv() to set PATH since the latter ## DP: allows the default PATH string to be clobbered, rendering it ## DP: not reusable on re-exec. @DPATCH@ diff -ur sysvinit-2.86.ds1/src/init.c_ORIG sysvinit-2.86.ds1/src/init.c --- sysvinit-2.86.ds1/src/init.c_ORIG 2005-12-31 11:51:03.000000000 +0100 +++ sysvinit-2.86.ds1/src/init.c 2005-12-31 11:58:48.000000000 +0100 @@ -2573,7 +2573,7 @@ /* * Set default PATH variable. */ - putenv(PATH_DFL); + setenv("PATH", PATH_DEFAULT, 1 /* Overwrite */); /* * Initialize /var/run/utmp (only works if /var is on @@ -2612,6 +2612,11 @@ initlog(L_CO, bootmsg, "reloading"); sigfillset(&sgt); sigprocmask(SIG_UNBLOCK, &sgt, NULL); + + /* + * Set default PATH variable. + */ + setenv("PATH", PATH_DEFAULT, 0 /* Don't overwrite */); } start_if_needed(); diff -urNad --exclude=CVS --exclude=.svn ./src/init.h /tmp/dpep-work.2oIDao/trunk/src/init.h --- sysvinit-2.86.ds1/src/init.h_ORIG 2005-12-02 17:22:57.000000000 +0100 +++ sysvinit-2.86.ds1/src/init.h 2005-12-31 11:56:18.000000000 +0100 @@ -24,7 +24,7 @@ #define SLEEPTIME 300 /* Disable time */ /* Default path inherited by every child. */ -#define PATH_DFL "PATH=/bin:/usr/bin:/sbin:/usr/sbin" +#define PATH_DEFAULT "/sbin:/usr/sbin:/bin:/usr/bin" /* Prototypes. */