common.pl (encfs-1.9.4) | : | common.pl (encfs-1.9.5) | ||
---|---|---|---|---|
# Portable FUSE unmount | # Portable FUSE unmount | |||
# works on Linux AND OSX | # works on Linux AND OSX | |||
sub portable_unmount { | sub portable_unmount { | |||
my $crypt = shift; | my $crypt = shift; | |||
my $fusermount = qx(which fusermount); | qx(./build/encfs -u "$crypt" >/dev/null); | |||
chomp($fusermount); | ||||
if(-f $fusermount) { | ||||
qx($fusermount -u "$crypt"); | ||||
} else { | ||||
qx(umount "$crypt"); | ||||
} | ||||
} | } | |||
# Helper function | # Helper function | |||
# Get the MD5 sum of the file open at the filehandle | # Get the MD5 sum of the file open at the filehandle | |||
use Digest::MD5 qw(md5_hex); | use Digest::MD5 qw(md5_hex); | |||
sub md5fh | sub md5fh | |||
{ | { | |||
my $fh_orig = shift; | my $fh_orig = shift; | |||
open(my $fh, "<&", $fh_orig); # Duplicate the file handle so the seek | open(my $fh, "<&", $fh_orig); # Duplicate the file handle so the seek | |||
seek($fh, 0, 0); # does not affect the caller | seek($fh, 0, 0); # does not affect the caller | |||
End of changes. 1 change blocks. | ||||
7 lines changed or deleted | 1 lines changed or added |