From 4a064a5b6eafa6bf016db9886e792fd7e09c6f21 Mon Sep 17 00:00:00 2001 From: epg <> Date: Mon, 12 Sep 2005 15:26:54 +0000 Subject: [PATCH] (update_folders): Only error out if opening .folders failed for any reason other than ENOENT. For ENOENT, we'll go ahead and create it. --- minc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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("$@"); -- 2.56.0