Skip to content

Commit

Permalink
Merge pull request #312 from mknos/mkfifo-mode
Browse files Browse the repository at this point in the history
mkfifo: common -m usage
  • Loading branch information
briandfoy authored Nov 9, 2023
2 parents c8441aa + 021927f commit d9d834d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bin/mkfifo
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ sub sym_perms {
$what_mask |= $what{$_};
}

# printf "%o, %o, %o\n", $who_mask, $what_mask, $change;
# print "$how\n";

if ($how eq '+') {
$mode |= ($who_mask & $what_mask);
} elsif ($how eq '-') {
Expand All @@ -63,15 +60,15 @@ sub get_mode {
my $mode = shift;
my $real_mode;

if ($mode =~ /^0?[0-7]{3}$/) {
if ($mode =~ /^0?[0-7]{1,3}$/) {
return $real_mode = oct($mode);
}
$real_mode = sym_perms $mode;
return $real_mode unless $real_mode < 0;
die "bad mode: $mode\n";
}

my $mode = $opt_m ? get_mode $opt_m : $default_mode;
my $mode = defined $opt_m ? get_mode($opt_m) : $default_mode;

foreach my $fifo (@ARGV) {
mkfifo $fifo, $mode or die "can't make fifo $fifo: $!\n";
Expand Down

0 comments on commit d9d834d

Please sign in to comment.