Package: libfilehandle-fmode-perl
Version: 0.11-1
Severity: important
User: debian-h...@lists.debian.org
Usertags: hurd
Tags: patch

Hi,

Currently libfilehandle-fmode-perl fails to build on Debian GNU/Hurd due to 
Hurd including O_RDONLY
in O_RDWR, etc.

Attached is a patch for building on Hurd.  I have also tested the patch on 
GNU/Linux on i386.  I
haven't tested it on other archs/OSs.

Thank you,

Barry deFreese

--- libfilehandle-fmode-perl-0.11.orig/Fmode.pm
+++ libfilehandle-fmode-perl-0.11/Fmode.pm
@@ -1,5 +1,5 @@
 package FileHandle::Fmode;
-use Fcntl qw(O_WRONLY O_RDWR O_APPEND F_GETFL);
+use Fcntl qw(O_ACCMODE O_RDONLY O_WRONLY O_RDWR O_APPEND F_GETFL);
 use strict;
 
 require Exporter;
@@ -45,7 +45,7 @@
       return 0;
     }
     my $fmode = fcntl($_[0], F_GETFL, my $slush = 0);
-    if(defined($fmode) && !($fmode & O_WRONLY) && !($fmode & O_RDWR)) {return 
1}
+    if(defined($fmode) && ($fmode & O_ACCMODE) == O_RDONLY) {return 1}
     return 0;
 }
 
@@ -61,7 +61,7 @@
       return 0;
     }
     my $fmode = fcntl($_[0], F_GETFL, my $slush = 0);
-    if($fmode & O_WRONLY) {return 1}
+    if(defined($fmode) && ($fmode & O_ACCMODE) == O_WRONLY) {return 1}
     return 0;
 }
 
@@ -87,7 +87,7 @@
       return 0;
     }
     my $fmode = fcntl($_[0], F_GETFL, my $slush = 0);
-    if($fmode & O_RDWR) {return 1}
+    if(defined($fmode) && ($fmode & O_ACCMODE) == O_RDWR) {return 1}
     return 0;
 }
 

Reply via email to