remove utimes() workarounds
With the addition of utimes(), we can remove the workarounds and use the original NetBSD code for timestamping files. Also restore use of -p & -r for install while building
This commit is contained in:
parent
3ae6c600a9
commit
a0a1440a52
13 changed files with 9 additions and 118 deletions
|
@ -846,18 +846,8 @@ set_ftime(char *fnm, time_t mtime, time_t atime, int frc, int slk)
|
||||||
#endif
|
#endif
|
||||||
if (slk)
|
if (slk)
|
||||||
return;
|
return;
|
||||||
#ifdef __minix
|
|
||||||
{
|
|
||||||
struct utimbuf timp;
|
|
||||||
timp.actime = atime;
|
|
||||||
timp.modtime = mtime;
|
|
||||||
if (utime(fnm, &timp) < 0)
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (utimes(fnm, tv) == -1)
|
if (utimes(fnm, tv) == -1)
|
||||||
goto bad;
|
goto bad;
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
bad:
|
bad:
|
||||||
syswarn(1, errno, "Access/modification time set failed on: %s", fnm);
|
syswarn(1, errno, "Access/modification time set failed on: %s", fnm);
|
||||||
|
|
|
@ -35,10 +35,12 @@
|
||||||
* @(#)pax.h 8.2 (Berkeley) 4/18/94
|
* @(#)pax.h 8.2 (Berkeley) 4/18/94
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ! HAVE_NBTOOL_CONFIG_H && !defined(__minix)
|
#if ! HAVE_NBTOOL_CONFIG_H
|
||||||
#define HAVE_LUTIMES 1
|
#define HAVE_LUTIMES 1
|
||||||
|
#ifndef __minix
|
||||||
#define HAVE_STRUCT_STAT_ST_FLAGS 1
|
#define HAVE_STRUCT_STAT_ST_FLAGS 1
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BSD PAX global data structures and constants.
|
* BSD PAX global data structures and constants.
|
||||||
|
|
|
@ -779,7 +779,6 @@ fetch(char *URL, const char *path)
|
||||||
*/
|
*/
|
||||||
signal:
|
signal:
|
||||||
/* set mtime of local file */
|
/* set mtime of local file */
|
||||||
#ifndef __minix
|
|
||||||
if (!n_flag && us.mtime && !o_stdout && of != NULL &&
|
if (!n_flag && us.mtime && !o_stdout && of != NULL &&
|
||||||
(stat(path, &sb) != -1) && sb.st_mode & S_IFREG) {
|
(stat(path, &sb) != -1) && sb.st_mode & S_IFREG) {
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
|
@ -791,19 +790,6 @@ fetch(char *URL, const char *path)
|
||||||
if (utimes(tmppath ? tmppath : path, tv))
|
if (utimes(tmppath ? tmppath : path, tv))
|
||||||
warn("%s: utimes()", tmppath ? tmppath : path);
|
warn("%s: utimes()", tmppath ? tmppath : path);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (!n_flag && us.mtime && !o_stdout && of != NULL &&
|
|
||||||
(stat(path, &sb) != -1) && sb.st_mode & S_IFREG) {
|
|
||||||
struct utimbuf ut;
|
|
||||||
|
|
||||||
fflush(of);
|
|
||||||
ut.actime = (us.atime ? us.atime : us.mtime);
|
|
||||||
ut.modtime = us.mtime;
|
|
||||||
|
|
||||||
if (utime(tmppath ? tmppath : path, &ut))
|
|
||||||
warn("%s: utime()", tmppath ? tmppath : path);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* timed out or interrupted? */
|
/* timed out or interrupted? */
|
||||||
if (fetchLastErrCode == FETCH_TIMEOUT)
|
if (fetchLastErrCode == FETCH_TIMEOUT)
|
||||||
|
|
|
@ -59,7 +59,6 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
struct utimbuf timbuf;
|
|
||||||
int aflag, cflag, mflag, ch, fd, len, rval, timeset;
|
int aflag, cflag, mflag, ch, fd, len, rval, timeset;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -141,28 +140,14 @@ main(int argc, char *argv[])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!aflag)
|
if (!aflag)
|
||||||
TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
|
TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
|
||||||
if (!mflag)
|
if (!mflag)
|
||||||
TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec);
|
TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec);
|
||||||
#else
|
|
||||||
if (!aflag)
|
|
||||||
tv[0].tv_sec = sb.st_atime;
|
|
||||||
if (!mflag)
|
|
||||||
tv[1].tv_sec = sb.st_mtime;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Try utimes(2). */
|
/* Try utimes(2). */
|
||||||
#if 0
|
|
||||||
if (!utimes(*argv, tv))
|
if (!utimes(*argv, tv))
|
||||||
continue;
|
continue;
|
||||||
#else
|
|
||||||
timbuf.actime = tv[0].tv_sec;
|
|
||||||
timbuf.modtime = tv[1].tv_sec;
|
|
||||||
if (!utime(*argv, &timbuf))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If the user specified a time, nothing else we can do. */
|
/* If the user specified a time, nothing else we can do. */
|
||||||
if (timeset) {
|
if (timeset) {
|
||||||
|
@ -176,13 +161,8 @@ main(int argc, char *argv[])
|
||||||
* The permission checks are different, too, in that the
|
* The permission checks are different, too, in that the
|
||||||
* ability to write the file is sufficient. Take a shot.
|
* ability to write the file is sufficient. Take a shot.
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
if (!utimes(*argv, NULL))
|
if (!utimes(*argv, NULL))
|
||||||
continue;
|
continue;
|
||||||
#else
|
|
||||||
if (!utime(*argv, NULL))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rval = 1;
|
rval = 1;
|
||||||
warn("%s", *argv);
|
warn("%s", *argv);
|
||||||
|
@ -310,13 +290,8 @@ stime_file(char *fname, struct timeval *tvp)
|
||||||
|
|
||||||
if (stat(fname, &sb))
|
if (stat(fname, &sb))
|
||||||
err(1, "%s", fname);
|
err(1, "%s", fname);
|
||||||
#if 0
|
|
||||||
TIMESPEC_TO_TIMEVAL(tvp, &sb.st_atimespec);
|
TIMESPEC_TO_TIMEVAL(tvp, &sb.st_atimespec);
|
||||||
TIMESPEC_TO_TIMEVAL(tvp + 1, &sb.st_mtimespec);
|
TIMESPEC_TO_TIMEVAL(tvp + 1, &sb.st_mtimespec);
|
||||||
#else
|
|
||||||
(tvp + 0)->tv_sec = sb.st_atime;
|
|
||||||
(tvp + 1)->tv_sec = sb.st_mtime;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__dead void
|
__dead void
|
||||||
|
|
2
external/bsd/file/include/config.h
vendored
2
external/bsd/file/include/config.h
vendored
|
@ -172,7 +172,7 @@
|
||||||
#define HAVE_UTIME 1
|
#define HAVE_UTIME 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `utimes' function. */
|
/* Define to 1 if you have the `utimes' function. */
|
||||||
/* #undef HAVE_UTIMES */
|
#define HAVE_UTIMES 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <utime.h> header file. */
|
/* Define to 1 if you have the <utime.h> header file. */
|
||||||
#define HAVE_UTIME_H 1
|
#define HAVE_UTIME_H 1
|
||||||
|
|
|
@ -242,7 +242,7 @@
|
||||||
/* #undef HAVE_FUTIMENS */
|
/* #undef HAVE_FUTIMENS */
|
||||||
|
|
||||||
/* Define to 1 if you have the `futimes' function. */
|
/* Define to 1 if you have the `futimes' function. */
|
||||||
/* #define HAVE_FUTIMES 1 */
|
#define HAVE_FUTIMES 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `geteuid' function. */
|
/* Define to 1 if you have the `geteuid' function. */
|
||||||
#define HAVE_GETEUID 1
|
#define HAVE_GETEUID 1
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */
|
/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */
|
||||||
|
|
||||||
/* Define to 1 if you have the `lutimes' function. */
|
/* Define to 1 if you have the `lutimes' function. */
|
||||||
/* #define HAVE_LUTIMES 1 */
|
#define HAVE_LUTIMES 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <lzmadec.h> header file. */
|
/* Define to 1 if you have the <lzmadec.h> header file. */
|
||||||
/* #undef HAVE_LZMADEC_H */
|
/* #undef HAVE_LZMADEC_H */
|
||||||
|
@ -570,7 +570,7 @@
|
||||||
/* #undef HAVE_UTIMENSAT */
|
/* #undef HAVE_UTIMENSAT */
|
||||||
|
|
||||||
/* Define to 1 if you have the `utimes' function. */
|
/* Define to 1 if you have the `utimes' function. */
|
||||||
/* #define HAVE_UTIMES 1 */
|
#define HAVE_UTIMES 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <utime.h> header file. */
|
/* Define to 1 if you have the <utime.h> header file. */
|
||||||
#define HAVE_UTIME_H 1
|
#define HAVE_UTIME_H 1
|
||||||
|
|
4
external/public-domain/xz/include/config.h
vendored
4
external/public-domain/xz/include/config.h
vendored
|
@ -90,7 +90,7 @@
|
||||||
#define HAVE_FCNTL_H 1
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `futimens' function. */
|
/* Define to 1 if you have the `futimens' function. */
|
||||||
/* #undef HAVE_FUTIMENS */
|
#define HAVE_FUTIMENS 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `futimes' function. */
|
/* Define to 1 if you have the `futimes' function. */
|
||||||
#define HAVE_FUTIMES 1
|
#define HAVE_FUTIMES 1
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
/* #undef HAVE_UTIME */
|
/* #undef HAVE_UTIME */
|
||||||
|
|
||||||
/* Define to 1 if you have the `utimes' function. */
|
/* Define to 1 if you have the `utimes' function. */
|
||||||
/* #undef HAVE_UTIMES */
|
#define HAVE_UTIMES 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `wcwidth' function. */
|
/* Define to 1 if you have the `wcwidth' function. */
|
||||||
#define HAVE_WCWIDTH 1
|
#define HAVE_WCWIDTH 1
|
||||||
|
|
|
@ -1053,16 +1053,12 @@ MKTRACE:= no
|
||||||
# install(1) parameters.
|
# install(1) parameters.
|
||||||
#
|
#
|
||||||
COPY?= -c
|
COPY?= -c
|
||||||
.if ${HOST_OSTYPE:C/\-.*//} != "Minix"
|
|
||||||
.if ${MKUPDATE} == "no"
|
.if ${MKUPDATE} == "no"
|
||||||
PRESERVE?=
|
PRESERVE?=
|
||||||
.else
|
.else
|
||||||
#LSC: Not supported by MINIX install
|
|
||||||
PRESERVE?= -p
|
PRESERVE?= -p
|
||||||
.endif
|
.endif
|
||||||
#XXX: Not supported by MINIX install
|
|
||||||
RENAME?= -r
|
RENAME?= -r
|
||||||
.endif # != "Minix"
|
|
||||||
HRDLINK?= -l h
|
HRDLINK?= -l h
|
||||||
SYMLINK?= -l s
|
SYMLINK?= -l s
|
||||||
|
|
||||||
|
|
|
@ -64,10 +64,6 @@ __RCSID("$NetBSD: fetch.c,v 1.202 2013/02/23 13:47:36 christos Exp $");
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef __minix
|
|
||||||
#include <utime.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ssl.h"
|
#include "ssl.h"
|
||||||
#include "ftp_var.h"
|
#include "ftp_var.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
@ -1322,39 +1318,19 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
|
||||||
progressmeter(1);
|
progressmeter(1);
|
||||||
(void)fflush(fout);
|
(void)fflush(fout);
|
||||||
if (closefunc == fclose && mtime != -1) {
|
if (closefunc == fclose && mtime != -1) {
|
||||||
#ifdef __minix
|
|
||||||
struct utimbuf utb;
|
|
||||||
#endif /* __minix */
|
|
||||||
|
|
||||||
struct timeval tval[2];
|
struct timeval tval[2];
|
||||||
|
|
||||||
(void)gettimeofday(&tval[0], NULL);
|
(void)gettimeofday(&tval[0], NULL);
|
||||||
|
|
||||||
#ifdef __minix
|
|
||||||
utb.actime = tval[0].tv_sec;
|
|
||||||
utb.modtime = mtime;
|
|
||||||
#else /* !__minix */
|
|
||||||
tval[1].tv_sec = mtime;
|
tval[1].tv_sec = mtime;
|
||||||
tval[1].tv_usec = 0;
|
tval[1].tv_usec = 0;
|
||||||
#endif /* !__minix */
|
|
||||||
|
|
||||||
(*closefunc)(fout);
|
(*closefunc)(fout);
|
||||||
fout = NULL;
|
fout = NULL;
|
||||||
|
|
||||||
#ifdef __minix
|
|
||||||
if (utime(savefile, &utb) == -1) {
|
|
||||||
fprintf(ttyout,
|
|
||||||
"Can't change modification time to %s",
|
|
||||||
rfc2822time(localtime(&mtime)));
|
|
||||||
}
|
|
||||||
#else /* !__minix */
|
|
||||||
if (utimes(savefile, tval) == -1) {
|
if (utimes(savefile, tval) == -1) {
|
||||||
fprintf(ttyout,
|
fprintf(ttyout,
|
||||||
"Can't change modification time to %s",
|
"Can't change modification time to %s",
|
||||||
rfc2822time(localtime(&mtime)));
|
rfc2822time(localtime(&mtime)));
|
||||||
}
|
}
|
||||||
#endif /* !__minix */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
ptransfer(0);
|
ptransfer(0);
|
||||||
|
|
|
@ -123,10 +123,6 @@ __RCSID("$NetBSD: ftp.c,v 1.164 2012/07/04 06:09:37 is Exp $");
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef __minix
|
|
||||||
#include <utime.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ftp_var.h"
|
#include "ftp_var.h"
|
||||||
|
|
||||||
volatile sig_atomic_t abrtflag;
|
volatile sig_atomic_t abrtflag;
|
||||||
|
@ -914,10 +910,6 @@ recvrequest(const char *cmd, const char *volatile local, const char *remote,
|
||||||
int oprogress;
|
int oprogress;
|
||||||
int opreserve;
|
int opreserve;
|
||||||
|
|
||||||
#ifdef __minix
|
|
||||||
struct utimbuf utb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fout = NULL;
|
fout = NULL;
|
||||||
din = NULL;
|
din = NULL;
|
||||||
hashbytes = mark;
|
hashbytes = mark;
|
||||||
|
@ -1156,16 +1148,6 @@ recvrequest(const char *cmd, const char *volatile local, const char *remote,
|
||||||
mtime = remotemodtime(remote, 0);
|
mtime = remotemodtime(remote, 0);
|
||||||
if (mtime != -1) {
|
if (mtime != -1) {
|
||||||
(void)gettimeofday(&tval[0], NULL);
|
(void)gettimeofday(&tval[0], NULL);
|
||||||
#ifdef __minix
|
|
||||||
utb.actime = tval[0].tv_sec;
|
|
||||||
utb.modtime = mtime;
|
|
||||||
if (utime(local, &utb) == -1) {
|
|
||||||
fprintf(ttyout,
|
|
||||||
"Can't change modification time on %s to %s",
|
|
||||||
local,
|
|
||||||
rfc2822time(localtime(&mtime)));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
tval[1].tv_sec = mtime;
|
tval[1].tv_sec = mtime;
|
||||||
tval[1].tv_usec = 0;
|
tval[1].tv_usec = 0;
|
||||||
if (utimes(local, tval) == -1) {
|
if (utimes(local, tval) == -1) {
|
||||||
|
@ -1174,7 +1156,6 @@ recvrequest(const char *cmd, const char *volatile local, const char *remote,
|
||||||
local,
|
local,
|
||||||
rfc2822time(localtime(&mtime)));
|
rfc2822time(localtime(&mtime)));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1081,10 +1081,8 @@ copymodes(int fd, const struct stat *sbp, const char *file)
|
||||||
|
|
||||||
TIMESPEC_TO_TIMEVAL(×[0], &sb.st_atimespec);
|
TIMESPEC_TO_TIMEVAL(×[0], &sb.st_atimespec);
|
||||||
TIMESPEC_TO_TIMEVAL(×[1], &sb.st_mtimespec);
|
TIMESPEC_TO_TIMEVAL(×[1], &sb.st_mtimespec);
|
||||||
#ifndef __minix
|
|
||||||
if (futimes(fd, times) < 0)
|
if (futimes(fd, times) < 0)
|
||||||
maybe_warn("couldn't utimes: %s", file);
|
maybe_warn("couldn't utimes: %s", file);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -251,9 +251,6 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
dopreserve = 1;
|
dopreserve = 1;
|
||||||
#ifdef __minix
|
|
||||||
warn("Minix lacks support for futimes(3)/utimes(2)");
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
dorename = 1;
|
dorename = 1;
|
||||||
|
@ -774,7 +771,6 @@ install(char *from_name, char *to_name, u_int flags)
|
||||||
/*
|
/*
|
||||||
* Preserve the date of the source file.
|
* Preserve the date of the source file.
|
||||||
*/
|
*/
|
||||||
#ifndef __minix
|
|
||||||
if (dopreserve) {
|
if (dopreserve) {
|
||||||
#if HAVE_FUTIMES
|
#if HAVE_FUTIMES
|
||||||
if (futimes(to_fd, tv) == -1)
|
if (futimes(to_fd, tv) == -1)
|
||||||
|
@ -784,7 +780,6 @@ install(char *from_name, char *to_name, u_int flags)
|
||||||
warn("%s: utimes", to_name);
|
warn("%s: utimes", to_name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
(void)close(to_fd);
|
(void)close(to_fd);
|
||||||
|
|
||||||
|
|
|
@ -140,14 +140,6 @@ lchown(const char *path, uid_t owner, gid_t group)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
|
||||||
fake_utimes(const char *path, const struct timeval times[2])
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#undef utimes
|
|
||||||
#define utimes(path, times) fake_utimes(path, times)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue