mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 15:25:58 +00:00
now use utime()
This commit is contained in:
14
check.c
14
check.c
@@ -92,6 +92,11 @@ static char rcsid[] = "$Id$";
|
|||||||
#include <afs/kauth.h>
|
#include <afs/kauth.h>
|
||||||
#include <afs/kautils.h>
|
#include <afs/kautils.h>
|
||||||
#endif /* HAVE_AFS */
|
#endif /* HAVE_AFS */
|
||||||
|
#ifdef HAVE_UTIME
|
||||||
|
#include <utime.h>
|
||||||
|
#else
|
||||||
|
#include "utime.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -252,17 +257,18 @@ static int check_timestamp()
|
|||||||
|
|
||||||
static void update_timestamp()
|
static void update_timestamp()
|
||||||
{
|
{
|
||||||
register int fd;
|
|
||||||
|
|
||||||
/* become root */
|
/* become root */
|
||||||
set_perms(PERM_ROOT);
|
set_perms(PERM_ROOT);
|
||||||
|
|
||||||
if (timedir_is_good) {
|
if (timedir_is_good) {
|
||||||
(void) unlink(timestampfile_p);
|
if (utime(timestampfile_p, NULL) < 0) {
|
||||||
if ((fd = open(timestampfile_p, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)
|
int fd = open(timestampfile_p, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
perror("update_timestamp: open");
|
perror("update_timestamp: open");
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* relinquish root */
|
/* relinquish root */
|
||||||
set_perms(PERM_USER);
|
set_perms(PERM_USER);
|
||||||
|
Reference in New Issue
Block a user