]> granicus.if.org Git - sudo/commitdiff
now use utime()
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 18 Jun 1995 00:46:14 +0000 (00:46 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 18 Jun 1995 00:46:14 +0000 (00:46 +0000)
check.c

diff --git a/check.c b/check.c
index b6e7cdcee52531778f2782c7066d6c0a5d51d976..6566bce89f082a0780f3426e86684a53f466162b 100644 (file)
--- a/check.c
+++ b/check.c
@@ -92,6 +92,11 @@ static char rcsid[] = "$Id$";
 #include <afs/kauth.h>
 #include <afs/kautils.h>
 #endif /* HAVE_AFS */
+#ifdef HAVE_UTIME
+#include <utime.h>
+#else
+#include "utime.h"
+#endif
 
 
 /*
@@ -252,16 +257,17 @@ static int check_timestamp()
 
 static void update_timestamp()
 {
-    register int fd;
-
     /* become root */
     set_perms(PERM_ROOT);
 
     if (timedir_is_good) {
-       (void) unlink(timestampfile_p);
-       if ((fd = open(timestampfile_p, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)
-           perror("update_timestamp: open");
-       close(fd);
+       if (utime(timestampfile_p, NULL) < 0) {
+           int fd = open(timestampfile_p, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+           if (fd < 0)
+               perror("update_timestamp: open");
+           close(fd);
+       }
     }
 
     /* relinquish root */