aboutsummaryrefslogtreecommitdiffstats
path: root/pullimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-01-21 17:54:53 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-01-21 18:11:53 +0100
commit1492f504316eb506e72f7a84ecd23207bb07e226 (patch)
treed08bd68be69707f2ff4121c210b2305eba231e85 /pullimap
parentd19ba0a20d0d7a7ec288c93df329210b31bf3c51 (diff)
pullimap, interimap: don't autocreate statefile or database in long-lived 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: $!";