]> granicus.if.org Git - sudo/commitdiff
Add an extra param to touch() for nsec
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 7 Sep 2004 19:55:37 +0000 (19:55 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 7 Sep 2004 19:55:37 +0000 (19:55 +0000)
check.c
fileops.c
sudo.h
sudo_edit.c
visudo.c

diff --git a/check.c b/check.c
index a333e15d9459f4ad23e8ead43a7266dfe6d5ccf6..826d952d7c5728f9769916f62d0db608304ffeb1 100644 (file)
--- a/check.c
+++ b/check.c
@@ -153,7 +153,7 @@ update_timestamp(timestampdir, timestampfile)
 
     if (timestamp_uid != 0)
        set_perms(PERM_TIMESTAMP);
-    if (touch(-1, timestampfile ? timestampfile : timestampdir, now) == -1) {
+    if (touch(-1, timestampfile ? timestampfile : timestampdir, now, 0) == -1) {
        if (timestampfile) {
            int fd = open(timestampfile, O_WRONLY|O_CREAT|O_TRUNC, 0600);
 
@@ -552,7 +552,7 @@ remove_timestamp(remove)
                remove = FALSE;
            }
        }
-       if (!remove && touch(-1, ts, 0) == -1)
+       if (!remove && touch(-1, ts, 0, 0) == -1)
            err(1, "can't reset %s to Epoch", ts);
     }
 
index 643de5da31c7b2cc61b967509c97bfc9aa9eef21..fd8407efe0b599d250c003d0f5936b06e3ede199 100644 (file)
--- a/fileops.c
+++ b/fileops.c
@@ -43,15 +43,16 @@ static const char rcsid[] = "$Sudo$";
  * Update the access and modify times on an fd or file.
  */
 int
-touch(fd, path, when)
+touch(fd, path, sec, nsec)
     int fd;
     char *path;
-    time_t when;
+    time_t sec;
+    long nsec;
 {
     struct timeval times[2];
 
-    times[0].tv_sec = times[1].tv_sec = when;
-    times[0].tv_usec = times[1].tv_usec = 0;
+    times[0].tv_sec = times[1].tv_sec = sec;
+    times[0].tv_usec = times[1].tv_usec = nsec;
 
 #if defined(HAVE_FUTIME) || defined(HAVE_FUTIMES)
     if (fd != -1)
diff --git a/sudo.h b/sudo.h
index 09870299566bec1f197f1293046fd9bafd4bc676..b404129de64522bc275096ab3e85dbedbd0dbae1 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -229,7 +229,7 @@ void dump_defaults  __P((void));
 void dump_auth_methods __P((void));
 void init_envtables    __P((void));
 int lock_file          __P((int, int));
-int touch              __P((int, char *, time_t));
+int touch              __P((int, char *, time_t, long));
 int user_is_exempt     __P((void));
 void set_fqdn          __P((void));
 int set_runaspw                __P((char *));
index f2924edd3054895e5dbc006957dc23524fa386fb..c5a638b41a48e87d71892847f672687f912e77a0 100644 (file)
@@ -159,7 +159,7 @@ int sudo_edit(argc, argv)
         * file's mtime.  It is better than nothing and we only use the info
         * to determine whether or not a file has been modified.
         */
-       if (touch(tf[i].tfd, NULL, tf[i].omtime) == -1) {
+       if (touch(tf[i].tfd, NULL, tf[i].omtime, 0) == -1) {
            if (fstat(tf[i].tfd, &sb) == 0)
                tf[i].omtime = sb.st_mtime;
        }
index e2c8eebab54594fa809eea3d8e5195871c7c69f8..cef880ee789c2e669c4ce991baff7c64d3d3fcdc 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -220,7 +220,7 @@ main(argc, argv)
            write(stmp_fd, buf, 1);
        }
 
-       (void) touch(stmp_fd, stmp, sudoers_sb.st_mtime);
+       (void) touch(stmp_fd, stmp, sudoers_sb.st_mtime, 0);
        (void) close(stmp_fd);
 
        /* Parse sudoers to pull in editor and env_editor conf values. */