Greetings: I like to use "/bin/env - PATH=..." to start things off with a clean environment, but someone recently reminded me of the existence of envdir. The patch below tells envdir to zap the environment if the directory used as the first argument has the sticky bit turned on. Comments welcome. -- Karl Vogel ASC/YCOA, Wright-Patterson AFB, OH 45433, USA [EMAIL PROTECTED] or [EMAIL PROTECTED] Nothing helps a bad mood like spreading it around. --Calvin & Hobbes --------------------------------------------------------------------------- *** envdir.c.orig Mon Mar 6 00:21:09 2000 --- envdir.c Fri Nov 3 19:50:26 2000 *************** *** 1,2 **** --- 1,4 ---- + #include <sys/types.h> + #include <sys/stat.h> #include "byte.h" #include "open.h" *************** *** 8,11 **** --- 10,15 ---- #include "pathexec.h" + extern char **environ; + #define FATAL "envdir: fatal: " *************** *** 28,31 **** --- 32,36 ---- direntry *d; int i; + struct stat st; if (!*argv) die_usage(); *************** *** 45,48 **** --- 50,64 ---- if (!dir) strerr_die4sys(111,FATAL,"unable to read directory ",fn,": "); + + if (stat(".",&st) == -1) + strerr_die4sys(111,FATAL,"unable to stat directory ",fn,": "); + + if (st.st_mode & 01000) { + environ = (char **) malloc (sizeof (char *)); + if (!environ) nomem(); + environ[0] = (char *) 0; + if (!pathexec_env("PATH", "/bin:/usr/bin")) nomem(); + } + for (;;) { errno = 0;