aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2016-11-18 11:32:22 +0000
committerNIIBE Yutaka <[email protected]>2016-11-18 11:32:22 +0000
commit1c0b140cccfb884c6d07785c3284b9df06dccd3c (patch)
tree12489471934317d8b9a20ac219ed99ead877c152
parentdirmngr: Use a longer timer tick interval. (diff)
downloadgnupg-1c0b140cccfb884c6d07785c3284b9df06dccd3c.tar.gz
gnupg-1c0b140cccfb884c6d07785c3284b9df06dccd3c.zip
g10: Fix flags to open for lock of ToFU.
* g10/tofu.c (busy_handler): Fix the flags and utime is not needed. -- The argument flags must include one of O_RDONLY, O_WRONLY, or O_RDWR. Adding O_TRUNC, the file is updated. So, utime is not needed. Fixes-commit: b2e1b17efa952afcf7aeec8b15e9d0088dba587a Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--g10/tofu.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/g10/tofu.c b/g10/tofu.c
index cf1d00aae..2c9d17cda 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -732,16 +732,13 @@ busy_handler (void *cookie, int call_count)
process will have to wait a bit longer, but otherwise nothing
horrible should happen. */
- int fd = open (dbs->want_lock_file, O_CREAT,
+ int fd = open (dbs->want_lock_file, O_CREAT|O_WRONLY|O_TRUNC,
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR);
if (fd == -1)
log_debug ("TOFU: Error opening '%s': %s\n",
dbs->want_lock_file, strerror (errno));
else
- {
- utime (dbs->want_lock_file, NULL);
- close (fd);
- }
+ close (fd);
}
/* Call again. */