diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2019-01-21 17:54:53 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2019-01-21 18:11:53 +0100 |
commit | 1492f504316eb506e72f7a84ecd23207bb07e226 (patch) | |
tree | d08bd68be69707f2ff4121c210b2305eba231e85 /pullimap | |
parent | d19ba0a20d0d7a7ec288c93df329210b31bf3c51 (diff) |
pullimap, interimap: don't autocreate statefile or database in long-lived mode.
Diffstat (limited to 'pullimap')
-rwxr-xr-x | pullimap | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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: $!"; |