From: Ansgar Burchardt Date: Thu, 6 Dec 2012 15:04:52 +0000 (+0100) Subject: debianqueued: use POSIX::access to check for write access X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85cdc5c8b9bff015cc07c6cc2daf8f176a1f1b7b;p=dak debianqueued: use POSIX::access to check for write access --- diff --git a/tools/debianqueued-0.9/debianqueued b/tools/debianqueued-0.9/debianqueued index 8dd54c49..c19c1c33 100755 --- a/tools/debianqueued-0.9/debianqueued +++ b/tools/debianqueued-0.9/debianqueued @@ -2095,17 +2095,9 @@ sub check_incoming_writable() { unlink $file; ftp_cmd( "delete", $file ); } elsif ( $conf::upload_method eq "copy" ) { - unlink("$main::current_targetdir/$testfile"); - unless (open my $fh, ">>", "$main::current_targetdir/$testfile") { + unless(POSIX::access($main::current_targetdir, &POSIX::W_OK)) { + $msg = "No write access: $!"; $stat = 1; - $msg = "Could not create $testfile: $!"; - } - else { - close $fh; - unless (unlink("$main::current_targetdir/$testfile")) { - $stat = 1; - $msg = "Could not unlink file $testfile: $!"; - } } } chomp($msg);