Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xinstall always stat into &from_sb and setup tv[]; s...
details: https://anonhg.NetBSD.org/src/rev/966f7e3e2a0c
branches: trunk
changeset: 525342:966f7e3e2a0c
user: lukem <lukem%NetBSD.org@localhost>
date: Wed Apr 10 06:02:52 2002 +0000
description:
always stat into &from_sb and setup tv[]; stops weird problem noticed
by Simon Burge when installing from /dev/null resulted in weird dates.
diffstat:
usr.bin/xinstall/xinstall.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diffs (57 lines):
diff -r 94e6610b26ca -r 966f7e3e2a0c usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c Wed Apr 10 05:26:15 2002 +0000
+++ b/usr.bin/xinstall/xinstall.c Wed Apr 10 06:02:52 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xinstall.c,v 1.69 2002/03/19 14:17:04 lukem Exp $ */
+/* $NetBSD: xinstall.c,v 1.70 2002/04/10 06:02:52 lukem Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -50,7 +50,7 @@
#if 0
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#else
-__RCSID("$NetBSD: xinstall.c,v 1.69 2002/03/19 14:17:04 lukem Exp $");
+__RCSID("$NetBSD: xinstall.c,v 1.70 2002/04/10 06:02:52 lukem Exp $");
#endif
#endif /* not lint */
@@ -527,10 +527,20 @@
int devnull, from_fd, to_fd, serrno, tmpmode;
char *p, tmpl[MAXPATHLEN], *oto_name;
+ if (stat(from_name, &from_sb))
+ err(1, "%s: stat", from_name);
+#ifdef BSD4_4
+ TIMESPEC_TO_TIMEVAL(&tv[0], &from_sb.st_atimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &from_sb.st_mtimespec);
+#else
+ tv[0].tv_sec = from_sb.st_atime;
+ tv[0].tv_usec = 0;
+ tv[1].tv_sec = from_sb.st_mtime;
+ tv[1].tv_usec = 0;
+#endif
+
if (flags & DIRECTORY || strcmp(from_name, _PATH_DEVNULL)) {
if (!dolink) {
- if (stat(from_name, &from_sb))
- err(1, "%s: stat", from_name);
if (!S_ISREG(from_sb.st_mode))
errx(1, "%s: not a regular file", from_name);
}
@@ -642,15 +652,6 @@
* Preserve the date of the source file.
*/
if (dopreserve) {
-#ifdef BSD4_4
- TIMESPEC_TO_TIMEVAL(&tv[0], &from_sb.st_atimespec);
- TIMESPEC_TO_TIMEVAL(&tv[1], &from_sb.st_mtimespec);
-#else
- tv[0].tv_sec = from_sb.st_atime;
- tv[0].tv_usec = 0;
- tv[1].tv_sec = from_sb.st_mtime;
- tv[1].tv_usec = 0;
-#endif
#if HAVE_FUTIMES
if (futimes(to_fd, tv) == -1)
warn("%s: futimes", to_name);
Home |
Main Index |
Thread Index |
Old Index