Some more patchelttes from Larry Doolittle.
[oweals/busybox.git] / busybox.c
index badd53d79de9a7c28dc34fbf1c46903d1f96e8b1..f3d0c4c2f02397b325872717b31bfb775d0783ea 100644 (file)
--- a/busybox.c
+++ b/busybox.c
@@ -37,10 +37,7 @@ typedef int (*__link_f)(const char *, const char *);
  */
 static char *busybox_fullpath()
 {
-       char proc[256];
-
-       sprintf(proc, "/proc/%d/exe", getpid());
-       return xreadlink(proc);
+       return xreadlink("/proc/self/exe");
 }
 
 /* create (sym)links for each applet */
@@ -79,15 +76,19 @@ int main(int argc, char **argv)
 
 #ifdef BB_SH
        /* Add in a special case hack -- whenever **argv == '-'
-        * (i.e. '-su' or '-sh') always invoke the shell */
+        * (i.e., '-su' or '-sh') always invoke the shell */
        if (**argv == '-' && *(*argv+1)!= '-') {
                applet_name = "sh";
        }
 #endif
 
-#ifdef BB_LOCALE_SUPPORT
+#ifdef BB_LOCALE_SUPPORT 
+#ifdef BB_INIT
        if(getpid()!=1) /* Do not set locale for `init' */
+#endif
+       {
                setlocale(LC_ALL, "");
+       }
 #endif
 
        run_applet_by_name(applet_name, argc, argv);