Cleanup patch from Vladimir N. Oleynik.
[oweals/busybox.git] / mkfifo.c
index ef3d667e2a981a52ab495f9f96849a884ff978e8..b31e6f172f67170f58d5606014eb933d6becc046 100644 (file)
--- a/mkfifo.c
+++ b/mkfifo.c
  *
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <stdio.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <errno.h>
-
-static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
-       "\nCreates a named pipe (identical to 'mknod name p')\n\n"
-       "Options:\n"
-       "\t-m\tcreate the pipe using the specified mode (default a=rw)\n"
-#endif
-       ;
+#include <stdlib.h>
 
 extern int mkfifo_main(int argc, char **argv)
 {
@@ -60,12 +52,9 @@ extern int mkfifo_main(int argc, char **argv)
                argc--;
                argv++;
        }
-       if (argc < 1)
+       if (argc < 1 || *argv[0] == '-')
                usage(mkfifo_usage);
-       if (mkfifo(*argv, mode) < 0) {
-               perror("mkfifo");
-               exit(255);
-       } else {
-               exit(TRUE);
-       }
+       if (mkfifo(*argv, mode) < 0)
+               perror_msg_and_die("mkfifo");
+       return EXIT_SUCCESS;
 }