diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2016-03-05 16:32:55 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2016-03-05 16:32:55 +0000 |
commit | 8ab15ea1a475470978112de501bf00de21e9c594 (patch) | |
tree | 44637fb156f0bc2fd739daf535988972e60a65ae /sbin | |
parent | 85848658574131d81b318fde45c940575c7f8f71 (diff) |
Use mknod(2) to create FIFOs by setting S_IFIFO in the mode.
Simplifies the logic in domakenodes() slightly. OK espie@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mknod/mknod.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/mknod/mknod.c b/sbin/mknod/mknod.c index ea55587cbed..594197aba6a 100644 --- a/sbin/mknod/mknod.c +++ b/sbin/mknod/mknod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mknod.c,v 1.21 2016/03/05 10:47:08 espie Exp $ */ +/* $OpenBSD: mknod.c,v 1.22 2016/03/05 16:32:54 millert Exp $ */ /* $NetBSD: mknod.c,v 1.8 1995/08/11 00:08:18 jtc Exp $ */ /* @@ -96,7 +96,7 @@ main(int argc, char *argv[]) if (ismkfifo) { while (*argv) { - node[n].mode = mode; + node[n].mode = mode | S_IFIFO; node[n].mflag = mflag; node[n].type = 'p'; node[n].name = *argv; @@ -120,6 +120,7 @@ main(int argc, char *argv[]) /* XXX computation offset by one for next getopt */ switch(node[n].type) { case 'p': + node[n].mode |= S_IFIFO; node[n].dev = 0; argv++; argc--; @@ -193,10 +194,7 @@ domakenodes(struct node *node, int n) done_umask = 1; } - if (node[i].type == 'p') - r = mkfifo(node[i].name, node[i].mode); - else - r = mknod(node[i].name, node[i].mode, node[i].dev); + r = mknod(node[i].name, node[i].mode, node[i].dev); if (r < 0) { warn("%s", node[i].name); rv = 1; |