Commit Graph

19 Commits

Author SHA1 Message Date
Michael Forney 01b5105e0c mkfifo: Simplify -m handling
Rather than create the FIFO with incorrect permissions at first, then
restore with chmod(2), just clear the umask when -m is specified, and
pass the parsed mode to mkfifo(2).
2019-06-13 13:45:37 -07:00
Richard Ipsum 2ee4c13433 mkfifo: Set initial mode
From POSIX:

In the symbolic_mode strings, the op characters '+' and '-'
shall be interpreted relative to an assumed initial mode of
a=rw.
2019-06-13 13:07:20 -07:00
sin 2366164de7 No need for semicolon after ARGEND
This is also the style used in Plan 9.
2015-11-01 10:18:55 +00:00
FRIGN 520d87e58e Audit mkfifo(1)
1) Fix usage()
2) Group local variables
3) Idiomatic argv-loop
4) BUGFIX: When the m-flag is specified, POSIX clearly says:
   "Set the file permission bits of the newly-created FIFO to the specified mode
   value."
   This means, that if mkfifo() fails for some reason, it should not try to
   chmod() the given path (which has been fixed with the "else if")
   A simple testcase is:

   $ touch testfile; mkfifo -m 000 testfile;

   GNU mkfifo(1): ls -l testfile
   -rw-r--r-- 1 testfile

   sbase mkfifo(1): ls -l testfile
   ---------- 1 testfile
5) Add blank line before return
2015-03-02 17:25:29 +01:00
FRIGN 31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
FRIGN befec8cf67 Add mandoc-manpage for mkfifo(1) and add full mode support
and mark it as finished in the README.

Previously, it would only parse octal mode strings. Given
we have the parsemode()-function in util.h anyway, why not
also use it?
2015-01-28 20:55:50 +01:00
sin d0604cc474 Don't stop at first failure in mkfifo(1) 2014-11-22 11:18:21 +00:00
FRIGN 1436518f9d Use < 0 instead of == -1 2014-11-19 20:09:29 +00:00
FRIGN 7d2683ddf2 Sort includes and more cleanup and fixes in util/ 2014-11-14 10:54:10 +00:00
FRIGN eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
sin 0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
Hiltjo Posthuma 953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
sin 7808f4161d Implement -m for mkfifo(1) 2013-11-30 20:58:15 +00:00
sin b5a511dacf Exit with EXIT_SUCCESS/EXIT_FAILURE instead of 0 and 1
Fixed for consistency purposes.
2013-10-07 16:44:22 +01:00
sin 428cd4fe84 None of these work without the proper # of arguments so print usage 2013-10-05 13:51:45 +01:00
stateless 7216a53a7e Remove unnecessary exit(1) in usage()
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2013-06-19 19:58:19 +02:00
Christoph Lohmann 4d38f60685 Eliminating the getopt disgrace. 2013-06-14 20:20:47 +02:00
Connor Lane Smith d90ced2047 consistent error check 2011-06-04 12:20:41 +01:00
Connor Lane Smith a9c970b973 add mkfifo 2011-05-25 11:00:15 +01:00