From: epg <> Date: Mon, 12 Sep 2005 15:26:54 +0000 (+0000) Subject: (update_folders): Only error out if opening .folders failed for any X-Git-Url: https://diplodocus.org/git/minc/commitdiff_plain/4a064a5b6eafa6bf016db9886e792fd7e09c6f21 (update_folders): Only error out if opening .folders failed for any reason other than ENOENT. For ENOENT, we'll go ahead and create it. --- diff --git a/minc b/minc index f1093e8..7951879 100755 --- a/minc +++ b/minc @@ -608,16 +608,18 @@ sub update_folders { my $folders = shift; my ($fh, $fn); - if (not open($fh, "$mh/.folders")) { + if (open($fh, "$mh/.folders")) { + while (<$fh>) { + chomp; + $folders->{$_}++; + } + } elsif (not $!{ENOENT}) { + # For ENOENT, we go ahead and create it, else we error and + # don't clobber it. warn("open($mh/.folders): $!"); return; } - while (<$fh>) { - chomp; - $folders->{$_}++; - } - eval { ($fh, $fn) = tempfile("$mh/.folders.XXXXX") }; if ($@) { warn("$@");