From a6dbb5d20f57fd557e7a7c49fb0729c89b977d5d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 19 Jun 1995 19:19:39 +0000 Subject: [PATCH] now deal correctly with all known variation of utime() -- yippe --- check.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/check.c b/check.c index 32fbf6a8b..49beb64b1 100644 --- a/check.c +++ b/check.c @@ -260,27 +260,27 @@ static int check_timestamp() static void update_timestamp() { #if defined(HAVE_UTIME) && !defined(HAVE_UTIME_NULL) -#ifdef HAVE_UTIME_H +#ifdef HAVE_UTIME_POSIX +#define UTP (&ut) struct utimbuf ut; - struct utimbuf *utp; ut.actime = ut.modtime = time(NULL); - utp = &ut; #else +#define UTP (ut) /* old BSD <= 4.3 has no struct utimbuf */ - time_t utp[2]; + time_t ut[2]; - utp[0] = utp[1] = time(NULL); -#endif /* HAVE_UTIME_H */ + ut[0] = ut[1] = time(NULL); +#endif /* HAVE_UTIME_POSIX */ #else - struct utimbuf *utp = (struct utimbuf *) NULL; +#define UTP NULL #endif /* HAVE_UTIME && !HAVE_UTIME_NULL */ /* become root */ set_perms(PERM_ROOT); if (timedir_is_good) { - if (utime(timestampfile_p, utp) < 0) { + if (utime(timestampfile_p, UTP) < 0) { int fd = open(timestampfile_p, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd < 0) @@ -292,6 +292,7 @@ static void update_timestamp() /* relinquish root */ set_perms(PERM_USER); } +#undef UTP