set_times() has one caller: Job_Touch(). set_times() is a thin
utimes(2) wrapper. Using utimes(2) to reset a file's atime/mtime
to the current time is not cumbersome.
So, remove set_times() and just call utimes(2) directly.
Thread: https://marc.info/?l=openbsd-tech&m=
171262211713835&w=2
ok kn@
-/* $OpenBSD: engine.c,v 1.73 2023/09/04 11:35:11 espie Exp $ */
+/* $OpenBSD: engine.c,v 1.74 2024/04/09 15:08:21 cheloha Exp $ */
/*
* Copyright (c) 2012 Marc Espie.
*
} else {
const char *file = gn->path != NULL ? gn->path : gn->name;
- if (set_times(file) == -1){
+ if (utimes(file, NULL) == -1){
if (rewrite_time(file) == -1) {
(void)fprintf(stderr,
"*** couldn't touch %s: %s", file,
-/* $OpenBSD: timestamp.c,v 1.11 2023/09/04 11:35:11 espie Exp $ */
+/* $OpenBSD: timestamp.c,v 1.12 2024/04/09 15:08:21 cheloha Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
struct timespec starttime;
-int
-set_times(const char *f)
-{
- return utimes(f, NULL);
-}
-
#define PLACEHOLDER "XXXXXXXXX "
char *
time_to_string(struct timespec *t)
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
-/* $OpenBSD: timestamp.h,v 1.11 2023/08/19 04:21:06 guenther Exp $ */
+/* $OpenBSD: timestamp.h,v 1.12 2024/04/09 15:08:21 cheloha Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
* ts_set_from_time_t(d, t): create timestamp from time_t.
*/
-/* sysresult = set_times(name): set modification times on a file.
- * system call results.
- */
-
#define Init_Timestamp() clock_gettime(CLOCK_REALTIME, &starttime)
#define TMIN (sizeof(time_t) == sizeof(int32_t) ? INT32_MIN : INT64_MIN)
(t).tv_nsec++; \
} while (0)
-extern int set_times(const char *);
-
extern struct timespec starttime; /* The time at the start
* of this whole process */
extern char *time_to_string(struct timespec *);