Subject: | FileHandle::Fmode fails to build on Debian GNU/Hurd due to Hurd including O_RDONLY in O_RDWR |
Hi,
on Debian, we have to patch FileHandle::Fmode to build it on Debian GNU/Hurd
Attached is a patch that may works on all platforms.
Subject: | fmode_perl_hurd.patch |
--- 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;
}