diff options
author | Mark Glines <mark@glines.org> | 2002-06-26 01:57:27 +0000 |
---|---|---|
committer | Mark Glines <mark@glines.org> | 2002-06-26 01:57:27 +0000 |
commit | a6e354a6145bf958701204cf3cf99c8f2ef1c0b2 (patch) | |
tree | 284dd2c1c20def4a5f5f5682884ff3a61b807820 /perl/loopback.pl | |
parent | f4736e7edbf5b5d8ad7fe416ffb59c571be6989b (diff) | |
download | libfuse-a6e354a6145bf958701204cf3cf99c8f2ef1c0b2.tar.gz |
fixed the last bug I know about!
Diffstat (limited to 'perl/loopback.pl')
-rw-r--r-- | perl/loopback.pl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/perl/loopback.pl b/perl/loopback.pl index 206eb81..bdc8c22 100644 --- a/perl/loopback.pl +++ b/perl/loopback.pl @@ -1,11 +1,11 @@ -#!/usr/bin/debugperl +#!/usr/bin/perl use strict; use Fuse; use IO::File; use POSIX qw(ENOENT ENOSYS EEXIST EPERM O_RDONLY O_RDWR O_APPEND O_CREAT); use Fcntl qw(S_ISBLK S_ISCHR S_ISFIFO SEEK_SET); -require 'syscall.ph'; # for SYS_mknod +require 'syscall.ph'; # for SYS_mknod and SYS_lchown sub fixup { return "/tmp/fusetest" . shift } @@ -67,7 +67,7 @@ sub x_readlink { return readlink(fixup(shift) ); } sub x_unlink { return unlink(fixup(shift)) ? 0 : -$!; } sub x_rmdir { return err(rmdir(fixup(shift)) ); } -sub x_symlink { return symlink(shift,fixup(shift)) ? 0 : -$!; } +sub x_symlink { print "symlink\n"; return symlink(shift,fixup(shift)) ? 0 : -$!; } sub x_rename { my ($old) = fixup(shift); @@ -78,8 +78,13 @@ sub x_rename { sub x_link { return link(fixup(shift),fixup(shift)) ? 0 : -$! } sub x_chown { my ($fn) = fixup(shift); + print "nonexistent $fn\n" unless -e $fn; my ($uid,$gid) = @_; - my ($err) = chown($uid,$gid,$fn) ? 0 : -$!; + # perl's chown() does not chown symlinks, it chowns the symlink's + # target. it fails when the link's target doesn't exist, because + # the stat64() syscall fails. + # this causes error messages when unpacking symlinks in tarballs. + my ($err) = syscall(&SYS_lchown,$fn,$uid,$gid,$fn) ? -$! : 0; return $err; } sub x_chmod { |