IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24299


Ignore:
Timestamp:
Jun 2, 2009, 10:53:58 AM (17 years ago)
Author:
jhoblitt
Message:

call fsync(3c) after chmod(2)ing an instance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r24294 r24299  
    2020use File::Path;
    2121use File::Spec;
     22use IO::File;
    2223use Log::Log4perl qw( :levels );
    2324use Nebulous::Key qw( parse_neb_key parse_neb_volume );
     
    16471648    # update each instances
    16481649    foreach my $inst (@$locations) {
    1649         chmod $mode, URI->new($inst)->path
     1650        my $path = URI->new($inst)->path;
     1651        chmod $mode, $path
    16501652            or $log->logdie("chmod() failed: $!");
     1653        # XXX I'm assuming that it's OK to fsync() a filehandle that's only
     1654        # open for reading?  Opening as w/rw here can fail if the chmod removes
     1655        # write permissions.
     1656        my $fh = IO::File->new($path, "r")
     1657            or $log->logdie("open() of $path failed: $!");;
     1658        # fsync(3c)
     1659        $fh->sync;
     1660        close ($fh)
     1661            or $log->logdie("close() failed: $!");
    16511662    }
    16521663
Note: See TracChangeset for help on using the changeset viewer.