]> git.g-eek.se Git - interimap.git/commitdiff
pullimap: fix struct flock packing
authorGuilhem Moulin <guilhem@fripost.org>
Sun, 13 Mar 2016 15:23:26 +0000 (16:23 +0100)
committerGuilhem Moulin <guilhem@fripost.org>
Sun, 13 Mar 2016 15:23:26 +0000 (16:23 +0100)
pullimap

index 317e88090855ca90d697ccc70477619cee453748..65e222b95b88e615d9eff84b6a01906e097ba7e4 100755 (executable)
--- a/pullimap
+++ b/pullimap
@@ -83,7 +83,9 @@ do {
     }
 
     sysopen($STATE, $statefile, O_CREAT|O_RDWR|O_DSYNC, 0600) or die "Can't open $statefile: $!";
-    fcntl($STATE, F_SETLK, pack('sslll', F_WRLCK, SEEK_SET, 0, 0, $$)) or die "Can't lock $statefile: $!";
+    # XXX we need to pack the struct flock manually: not portable!
+    my $struct_flock = pack('s!s!l!l!i!', F_WRLCK, SEEK_SET, 0, 0, 0);
+    fcntl($STATE, F_SETLK, $struct_flock) or die "Can't lock $statefile: $!";
     my $flags = fcntl($STATE, F_GETFD, 0)       or die "fcntl F_GETFD: $!";
     fcntl($STATE, F_SETFD, $flags | FD_CLOEXEC) or die "fcntl F_SETFD: $!";
 };