From: Derrik Pates Date: Tue, 2 Aug 2011 19:33:42 +0000 (-0600) Subject: Cast the 'cmd' argument as unsigned. X-Git-Url: http://git.rot13.org/?p=perl-fuse.git;a=commitdiff_plain;h=7f982ef01e7f172d79086ef68ddfd5591397f541 Cast the 'cmd' argument as unsigned. --- diff --git a/Fuse.xs b/Fuse.xs index 8d609fa..893f1a0 100755 --- a/Fuse.xs +++ b/Fuse.xs @@ -1430,7 +1430,10 @@ int _PLfuse_ioctl(const char *file, int cmd, void *arg, SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSVpv(file,0))); - XPUSHs(sv_2mortal(newSViv(cmd))); + /* I don't know why cmd is a signed int in the first place; + * casting as unsigned so stupid tricks don't have to be done on + * the perl side */ + XPUSHs(sv_2mortal(newSViv((unsigned int)cmd))); XPUSHs(sv_2mortal(newSViv(flags))); if (_IOC_DIR(cmd) & _IOC_WRITE) XPUSHs(sv_2mortal(newSVpvn(data, _IOC_SIZE(cmd)))); diff --git a/examples/fioc.pl b/examples/fioc.pl index 3461180..811cb80 100755 --- a/examples/fioc.pl +++ b/examples/fioc.pl @@ -147,7 +147,6 @@ sub fioc_readdir { sub fioc_ioctl { my ($path, $cmd, $flags, $data) = @_; print 'called ', (caller(0))[3], "\n"; - $cmd = unpack('L', pack('l', $cmd)); return -&EINVAL if fioc_file_type($path) != FIOC_FILE;