Add an extra param to touch() for nsec
This commit is contained in:
4
check.c
4
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);
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
2
sudo.h
2
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 *));
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user