X-Git-Url: https://diplodocus.org/git/flac-archive/blobdiff_plain/c59f7b94bee45a0b35303adae17b54f9321a75ab..bdd88820f3d1c0bafcdef990da8c51177a018ae7:/fa-flacd diff --git a/fa-flacd b/fa-flacd index cc8438f..167e6b9 100755 --- a/fa-flacd +++ b/fa-flacd @@ -30,7 +30,7 @@ my @jobs; my @finished; sub verbose { - $verbose and map({ print(STDERR $_) } @_); + $verbose and print(STDERR $_) for @_; } # Return the ARTIST, ALBUM, and DATE followed by a list of all the @@ -115,6 +115,8 @@ sub flac { rename("$artist/$album.flac-tmp", "$artist/$album.flac") or die("rename($artist/$album.flac-tmp, $artist/$album.flac): $!"); + + return 0; } sub reaper { @@ -132,13 +134,12 @@ sub newjob { my $pid; $pid = fork(); - if ($pid == -1) { + if (not defined($pid)) { die("fork: $!"); } elsif ($pid == 0) { $SIG{CHLD} = 'IGNORE'; open(STDERR, ">$dir/log") or die("open(STDERR, >$dir/log): $!"); - flac($dir); - exit(0); + exit(flac($dir)); } verbose("new job $pid for $dir\n"); @@ -152,7 +153,7 @@ sub deljob { my $status; $pid = $finished[$i][0]; - $status = WEXITSTATUS($finished[$i][1]); + $status = $finished[$i][1]; verbose("$pid finished ("); if (WIFEXITED($status)) {