]> granicus.if.org Git - sudo/commitdiff
Fix creation of the timestamp file; bug #704
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 21 Jul 2015 02:16:14 +0000 (20:16 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 21 Jul 2015 02:16:14 +0000 (20:16 -0600)
plugins/sudoers/timestamp.c

index 42abcd1e6f9eb345888125c92f89133b250ca89f..17efb07a62f30d6b6d0401adf89cc6b18cea5361 100644 (file)
@@ -308,8 +308,9 @@ build_timestamp(struct passwd *pw)
 }
 
 /*
- * Open and lock the specified timestamp file.
- * Returns 0 on success or -1 on failure.
+ * Open and lock the specified timestamp or lecture file.
+ * Returns open and locked file descriptor on success.
+ * Returns TIMESTAMP_OPEN_ERROR or TIMESTAMP_PERM_ERROR on error.
  */
 static int
 open_timestamp(const char *path, int flags)
@@ -320,7 +321,7 @@ open_timestamp(const char *path, int flags)
 
     if (timestamp_uid != 0)
        uid_changed = set_perms(PERM_TIMESTAMP);
-    fd = open(timestamp_file, flags, 0600);
+    fd = open(path, flags, 0600);
     if (uid_changed && !restore_perms()) {
        /* Unable to restore permissions, should not happen. */
        if (fd != -1) {