]> err.no Git - dak/commitdiff
debianqueued: use POSIX::access to check for write access
authorAnsgar Burchardt <ansgar@debian.org>
Thu, 6 Dec 2012 15:04:52 +0000 (16:04 +0100)
committerAnsgar Burchardt <ansgar@debian.org>
Thu, 6 Dec 2012 15:04:52 +0000 (16:04 +0100)
tools/debianqueued-0.9/debianqueued

index 8dd54c49957f8de534bbe71c8001a58d4fa355b4..c19c1c3311e546305caf8f5c4e09f0befc022164 100755 (executable)
@@ -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);