Imported Upstream version 1.7.4p4
[debian/sudo] / check.c
diff --git a/check.c b/check.c
index 8b7834a03b0f3a240f62396f29f9100cea2fa7a5..d6efa6d0befe153b9d8dcb251fda09371bbf538e 100644 (file)
--- a/check.c
+++ b/check.c
@@ -556,9 +556,12 @@ timestamp_status(timestampdir, timestampfile, user, flags)
                    /*
                     * Check for stored tty info.  If the file is zero-sized
                     * it is an old-style timestamp with no tty info in it.
+                    * If removing, we don't care about the contents.
                     * The actual mtime check is done later.
                     */
-                   if (sb.st_size != 0) {
+                   if (ISSET(flags, TS_REMOVE)) {
+                       status = TS_OLD;
+                   } else if (sb.st_size != 0) {
                        struct tty_info info;
                        int fd = open(timestampfile, O_RDONLY, 0644);
                        if (fd != -1) {
@@ -646,7 +649,7 @@ remove_timestamp(remove)
            }
        } else {
            timevalclear(&tv);
-           if (touch(-1, path, &tv) == -1)
+           if (touch(-1, path, &tv) == -1 && errno != ENOENT)
                error(1, "can't reset %s to Epoch", path);
        }
     }