From 1492f504316eb506e72f7a84ecd23207bb07e226 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 21 Jan 2019 17:54:53 +0100 Subject: pullimap, interimap: don't autocreate statefile or database in long-lived mode. --- pullimap | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pullimap') 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: $!"; -- cgit v1.2.3