[BusyBox] small path utilites.c

Vladimir N. Oleynik dzo at simtreas.ru
Sun Jan 7 18:05:56 UTC 2001


Developing my idea for code utilites.c, and remove potential bug.

--- utility.c.orig      Sun Jan  7 18:28:45 2001
+++ utility.c   Sun Jan  7 20:37:24 2001
@@ -81,4 +81,3 @@
 {
-       fprintf(stderr, "%s\n\n", full_version);
-       fprintf(stderr, "Usage: %s\n", usage);
+       fprintf(stderr, "%s\n\n" "Usage: %s\n", full_version, usage);
        exit(EXIT_FAILURE);
@@ -91,3 +90,2 @@
        vfprintf(stderr, s, p);
-       fflush(stderr);
 }
@@ -115,10 +113,10 @@
 {
-       fflush(stdout);
-       fprintf(stderr, "%s: ", applet_name);
-       if (s && *s) {
-               vfprintf(stderr, s, p);
-               fputs(": ", stderr);
-       }
-       fprintf(stderr, "%s\n", strerror(errno));
-       fflush(stderr);
+       int err = errno;
+       
+       if(s == 0)
+               s = "";
+       verror_msg(s, p);
+       if (*s)
+               s = ": "; 
+       fprintf(stderr, "%s%s\n", s, strerror(err));
 }


Bug is low-possible. Example, i have no true error message witch
use non iso-latin symbols and without installing locales on
small distr. witch busybox:

before this path:
any_applet: 'Non-iso-latin-symbols': Invalid or incomplete multibyte 
or wide character

after this path - true error:
any_applet: 'Non-iso-latin-symbols': No such file or directory


--w
vodz





More information about the busybox mailing list