bb_show_usage();
}
+/* We shouldn't do this. Ever. Not our business.
if (!getenv("PATH")) {
- setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin", 1);
+ putenv((char*)bb_PATH_root_path);
}
+*/
while (--argc > 0) {
argv++;
extern const char bb_busybox_exec_path[];
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here */
-extern const char bb_default_root_login_path[]; /* "/sbin:/usr/sbin:/bin:/usr/bin" */
-#define bb_default_login_path (bb_default_root_login_path + sizeof("/sbin:/usr/sbin"))
+extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
+#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
+#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
extern const int const_int_0;
extern const int const_int_1;
#define CONSOLE_NAME_SIZE 32
#define MAXENV 16 /* Number of env. vars */
-#ifndef _PATH_STDPATH
-#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
-#endif
-
#if ENABLE_FEATURE_INIT_COREDUMPS
/*
* When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called
static const char * const environment[] = {
"HOME=/",
- "PATH=" _PATH_STDPATH,
+ bb_PATH_root_path,
"SHELL=/bin/sh",
"USER=root",
NULL
const char bb_default_login_shell[] = LIBBB_DEFAULT_LOGIN_SHELL;
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here. Check libbb.h before changing! */
-const char bb_default_root_login_path[] = "/sbin:/usr/sbin:/bin:/usr/bin";
+const char bb_PATH_root_path[] = "PATH=/sbin:/usr/sbin:/bin:/usr/bin";
const int const_int_0;
xsetenv("SHELL", shell);
xsetenv("USER", pw->pw_name);
xsetenv("LOGNAME", pw->pw_name);
- xsetenv("PATH", (pw->pw_uid ? bb_default_login_path : bb_default_root_login_path));
+ xsetenv("PATH", (pw->pw_uid ? bb_default_path : bb_default_root_path));
}
else if (changeenv) {
/* Set HOME, SHELL, and if not becoming a super-user,
# define VDYNAMIC 0
#endif
-static const char defpathvar[] = "PATH=/usr/local/bin:/usr/bin:/sbin:/bin";
#ifdef IFS_BROKEN
static const char defifsvar[] = "IFS= \t\n";
#define defifs (defifsvar + 4)
{ NULL, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL\0", changemail },
{ NULL, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH\0", changemail },
#endif
- { NULL, VSTRFIXED|VTEXTFIXED, defpathvar, changepath },
+ { NULL, VSTRFIXED|VTEXTFIXED, bb_PATH_root_path, changepath },
{ NULL, VSTRFIXED|VTEXTFIXED, "PS1=$ ", NULL },
{ NULL, VSTRFIXED|VTEXTFIXED, "PS2=> ", NULL },
{ NULL, VSTRFIXED|VTEXTFIXED, "PS4=+ ", NULL },
#else
#define vrandom (&vps4)[1]
#endif
-#define defpath (defpathvar + 5)
/*
* The following macros access the values of the above variables.
do {
switch (c) {
case 'p':
- *path = defpath;
+ *path = bb_default_path;
break;
default:
/* run 'typecmd' for other options */
if (path->value == null) {
/* Can be merged with same string elsewhere in bbox */
if (geteuid() == 0)
- setval(path, bb_default_root_login_path);
+ setval(path, bb_default_root_path);
else
- setval(path, bb_default_login_path);
+ setval(path, bb_default_path);
}
export(path);