/[fuse-comp]/fuse-comp.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /fuse-comp.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25 by dpavlin, Mon Jul 9 22:44:20 2007 UTC revision 26 by dpavlin, Mon Jul 9 23:28:58 2007 UTC
# Line 166  sub x_open { Line 166  sub x_open {
166                  $pending->{$file}->{path} = $path;                  $pending->{$file}->{path} = $path;
167                  return 0;                  return 0;
168          } else {          } else {
169                  warn "ERROR: can't open $path : $!";                  warn "ERROR: can't open $path -- $!";
170                  return -$!;                  return -$!;
171          }          }
172    
# Line 194  sub x_read { Line 194  sub x_read {
194  sub x_write {  sub x_write {
195          my ($file,$buf,$off) = @_;          my ($file,$buf,$off) = @_;
196    
         $pending->{$file}->{write}++;  
197          my $rv;          my $rv;
198          my $path = fixup($file);          my $path = fixup($file);
199    
# Line 202  sub x_write { Line 201  sub x_write {
201    
202          return -ENOENT() unless -e $path;          return -ENOENT() unless -e $path;
203    
204            $path = $pending->{$file}->{path} || confess "no path for $file in ", dump( $pending );
205            confess "write into non-existant $path for $file: $!" unless -e $path;
206    
207          my $fh = new IO::File;          my $fh = new IO::File;
208          return -ENOSYS() unless open($fh,'+<',$pending->{$file}->{path});          return -ENOSYS() unless open($fh,'+<',$path);
209          if($rv = seek( $fh ,$off,SEEK_SET)) {          if($rv = seek( $fh ,$off,SEEK_SET)) {
210                  $rv = print( $fh $buf );                  $rv = print( $fh $buf );
211                  warn "## write ", $pending->{$file}->{path}, " $off ",length( $buf ), "\n" if $debug;                  warn "## write $path offset $off [",length( $buf ), "]\n" if $debug;
212                    $pending->{$file}->{write}++;
213          }          }
214          $rv = -ENOSYS() unless $rv;          $rv = -ENOSYS() unless $rv;
215          close($fh);          close($fh) || warn "can't close $path: $!";
216          return length($buf);          return length($buf);
217  }  }
218    
# Line 272  sub x_rename { Line 275  sub x_rename {
275  sub x_link { return link(fixup(shift),fixup(shift)) ? 0 : -$! }  sub x_link { return link(fixup(shift),fixup(shift)) ? 0 : -$! }
276    
277  sub x_chown {  sub x_chown {
278          my ($path) = fixup(shift);          my ($file,$uid,$gid) = @_;
279            my $path = fixup($file);
280          print "nonexistent $path\n" unless -e $path;          print "nonexistent $path\n" unless -e $path;
         my ($uid,$gid) = @_;  
281          # perl's chown() does not chown symlinks, it chowns the symlink's          # perl's chown() does not chown symlinks, it chowns the symlink's
282          # target.  it fails when the link's target doesn't exist, because          # target.  it fails when the link's target doesn't exist, because
283          # the stat64() syscall fails.          # the stat64() syscall fails.
284          # this causes error messages when unpacking symlinks in tarballs.          # this causes error messages when unpacking symlinks in tarballs.
285          my ($err) = syscall(&SYS_lchown,$path,$uid,$gid,$path) ? -$! : 0;          my ($err) = syscall(&SYS_lchown,$path,$uid,$gid,$path) ? -$! : 0;
286    
287            my $tmp = $mount->{tmp} . '/' . $file;
288            syscall(&SYS_lchown,$file,$uid,$gid,$path) if -e $tmp;
289    
290          return $err;          return $err;
291  }  }
292    

Legend:
Removed from v.25  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26