diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-08-16 09:53:44 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-08-16 09:53:44 +0000 |
commit | 402bf5a573f82f58d4a2b29376ae713fe46d495d (patch) | |
tree | b7cf9af9c5a697e7c771a64ce9ba1c37b9d6285c /usr.bin/make | |
parent | b05c076c884038ec8bf37d2d470cbe8d0c07e60b (diff) |
modify timestamp handling to grab current time instead of relying on a
stale timestamp.
all those diffs sent to people ages ago, who didn't answer, except for
Theo, who said he ran it with no issues, so let's get this in...
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/arch.c | 4 | ||||
-rw-r--r-- | usr.bin/make/compat.c | 8 | ||||
-rw-r--r-- | usr.bin/make/dir.c | 5 | ||||
-rw-r--r-- | usr.bin/make/make.c | 4 | ||||
-rw-r--r-- | usr.bin/make/timestamp.c | 9 |
5 files changed, 17 insertions, 13 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 23f6363e6fe..00548407aec 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: arch.c,v 1.75 2007/11/17 16:39:45 espie Exp $ */ +/* $OpenBSD: arch.c,v 1.76 2009/08/16 09:53:43 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -856,7 +856,7 @@ ArchTouch(const char *archive, const char *member) arch = ArchFindMember(archive, member, &arHeader, "r+"); if (arch != NULL) { snprintf(arHeader.ar_date, sizeof(arHeader.ar_date), - "%-12ld", (long) timestamp2time_t(now)); + "%-12ld", (long) time(NULL)); if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) == 0) (void)fwrite(&arHeader, sizeof(struct ar_hdr), 1, arch); fclose(arch); diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index e6d1c1035c9..bd148ba82e6 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: compat.c,v 1.71 2009/05/10 11:07:37 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.72 2009/08/16 09:53:43 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -97,7 +97,7 @@ CompatMake(void *gnp, /* The node to make */ if (pgn->type & OP_MADE) { sib = gn; do { - (void)Dir_MTime(sib); + sib->mtime = gn->mtime; sib->built_status = UPTODATE; sib = sib->sibling; } while (sib != gn); @@ -210,12 +210,12 @@ CompatMake(void *gnp, /* The node to make */ * havoc with files that depend on this one. */ if (noExecute || is_out_of_date(Dir_MTime(gn))) - gn->mtime = now; + ts_set_from_now(gn->mtime); if (is_strictly_before(gn->mtime, gn->cmtime)) gn->mtime = gn->cmtime; if (sib != gn) { if (noExecute || is_out_of_date(Dir_MTime(sib))) - sib->mtime = now; + ts_set_from_now(sib->mtime); if (is_strictly_before(sib->mtime, sib->cmtime)) sib->mtime = sib->cmtime; } diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index b43efefe89c..822cd1446a6 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: dir.c,v 1.56 2008/11/04 07:22:35 espie Exp $ */ +/* $OpenBSD: dir.c,v 1.57 2009/08/16 09:53:43 espie Exp $ */ /* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* @@ -754,6 +754,9 @@ Dir_MTime(GNode *gn) unsigned int slot; TIMESTAMP mtime; + if (gn->type & OP_PHONY) + return gn->mtime; + if (gn->type & OP_ARCHV) return Arch_MTime(gn); diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 1505e48856a..1fb27c80aa1 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: make.c,v 1.59 2009/05/10 11:07:37 espie Exp $ */ +/* $OpenBSD: make.c,v 1.60 2009/08/16 09:53:43 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -246,7 +246,7 @@ Make_Update(GNode *cgn) /* the child node */ * on this one. */ if (noExecute || is_out_of_date(Dir_MTime(cgn))) - cgn->mtime = now; + ts_set_from_now(cgn->mtime); if (DEBUG(MAKE)) printf("update time: %s\n", time_to_string(cgn->mtime)); } diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c index 78610157044..8e933dfd420 100644 --- a/usr.bin/make/timestamp.c +++ b/usr.bin/make/timestamp.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: timestamp.c,v 1.3 2007/09/16 12:09:36 espie Exp $ */ +/* $OpenBSD: timestamp.c,v 1.4 2009/08/16 09:53:43 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -42,13 +42,14 @@ set_times(const char *f) #ifdef USE_TIMESPEC struct timeval tv[2]; - TIMESPEC_TO_TIMEVAL(&tv[0], &now); - TIMESPEC_TO_TIMEVAL(&tv[1], &now); + gettimeofday(&tv[0], NULL); + tv[1] = tv[0]; return utimes(f, tv); #else struct utimbuf times; - times.actime = times.modtime = now; + time(×.actime); + times.modtime = times.actime; return utime(f, ×); #endif } |