diff options
author | Rob Landley <rob@landley.net> | 2012-03-06 21:19:57 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-03-06 21:19:57 -0600 |
commit | e430db2894bedba6e06693c93ddab4ae28bd7ca3 (patch) | |
tree | 22e7c8b73062f9a892299a54ef9734e0023538d3 /toys | |
parent | f656fc975856e929b63de3998e0b158bd8c7c38d (diff) | |
download | toybox-e430db2894bedba6e06693c93ddab4ae28bd7ca3.tar.gz |
Cleanups: use perror_msg() and make mode a global.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/mkfifo.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/toys/mkfifo.c b/toys/mkfifo.c index d560c0e7..17d9c2cb 100644 --- a/toys/mkfifo.c +++ b/toys/mkfifo.c @@ -15,19 +15,27 @@ config MKFIFO default y help usage: mkfifo [fifo_name...] - Create FIFOs (named pipes). + Create FIFOs (named pipes). */ #include "toys.h" +DEFINE_GLOBALS( + long mode; +) + +#define TT this.mkfifo + void mkfifo_main(void) { char **s; - mode_t mode = 0666; + + TT.mode = 0666; + for (s = toys.optargs; *s; s++) { - if (mknod(*s, S_IFIFO | mode, 0) < 0) { - fprintf(stderr, "mkfifo: cannot create fifo `%s': %s\n", *s, strerror(errno)); + if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) { + perror_msg("cannot create fifo '%s'", *s); toys.exitval = 1; } } |