Fix a few bugs in the new silent support.
Russ Allbery
16 years ago
24 | 24 | ############################################################################## |
25 | 25 | |
26 | 26 | use strict; |
27 | use Getopt::Long qw(GetOptions); | |
27 | 28 | use Fcntl qw(LOCK_EX O_WRONLY O_CREAT O_EXCL); |
28 | 29 | use POSIX qw(EEXIST); |
29 | 30 | |
168 | 169 | if (not defined $pid) { |
169 | 170 | die "$0: cannot fork: $!\n"; |
170 | 171 | } elsif ($pid == 0) { |
171 | unless ($silent) { | |
172 | if ($silent) { | |
172 | 173 | open (STDERR, '>&STDOUT') or die "$0: cannot dup STDOUT: $!\n"; |
173 | 174 | } |
174 | 175 | exec ($SYNC, '-f', $file) or die "$0: cannot exec $SYNC: $!\n"; |
181 | 182 | $ignore = 1 if $output =~ /$regex/; |
182 | 183 | } |
183 | 184 | if (not $silent) { |
184 | print $output; | |
185 | print $output if $output; | |
186 | warn "$0: krb5-sync failed on $file\n" unless $? == 0; | |
185 | 187 | } elsif (not $ignore and $? != 0) { |
186 | 188 | warn $output; |
187 | warn "$0: krb5-sync failed on $file\n" unless ($? == 0); | |
189 | warn "$0: krb5-sync failed on $file\n"; | |
188 | 190 | } |
189 | 191 | unless ($? == 0) { |
190 | 192 | $skipped{$id} = 1; |