aboutsummaryrefslogtreecommitdiffstats
path: root/pullimap
diff options
context:
space:
mode:
Diffstat (limited to 'pullimap')
-rwxr-xr-xpullimap6
1 files changed, 5 insertions, 1 deletions
diff --git a/pullimap b/pullimap
index bd9b1cf..b752b14 100755
--- a/pullimap
+++ b/pullimap
@@ -82,7 +82,11 @@ do {
die "Missing option statefile" unless defined $statefile;
$statefile = xdg_basedir( XDG_DATA_HOME => ".local/share", $NAME, $statefile );
- sysopen($STATE, $statefile, O_CREAT|O_RDWR|O_DSYNC, 0600) or die "Can't open $statefile: $!";
+ my $mode = O_RDWR | O_DSYNC;
+ # don't auto-create in long-lived mode
+ $mode |= O_CREAT unless defined $CONFIG{idle};
+
+ sysopen($STATE, $statefile, $mode, 0600) or die "Can't open $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: $!";