Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
futimens: replace deprecated futimes
Baptiste Daroussin committed 1 year ago
commit 963ba34d86946f9e0c220bd4c1f7a3995adfd626
parent f582afc
2 files changed +18 -18
modified libpkg/fetch.c
@@ -128,17 +128,17 @@ pkg_fetch_file_tmp(struct pkg_repo *repo, const char *url, char *dest,
	retcode = pkg_fetch_file_to_fd(repo, fd, &fi, false);

	if (fi.mtime != 0) {
-
		struct timeval ftimes[2] = {
+
		struct timespec ts[2] = {
			{
			.tv_sec = fi.mtime,
-
			.tv_usec = 0
+
			.tv_nsec = 0
			},
			{
			.tv_sec = fi.mtime,
-
			.tv_usec = 0
+
			.tv_nsec = 0
			}
		};
-
		futimes(fd, ftimes);
+
		futimens(fd, ts);
	}

	close(fd);
@@ -180,17 +180,17 @@ pkg_fetch_file(struct pkg_repo *repo, const char *url, char *dest, time_t t,
	free(url_to_free);

	if (t != 0) {
-
		struct timeval ftimes[2] = {
+
		struct timespec ts[2] = {
			{
			.tv_sec = t,
-
			.tv_usec = 0
+
			.tv_nsec = 0
			},
			{
			.tv_sec = t,
-
			.tv_usec = 0
+
			.tv_nsec = 0
			}
		};
-
		futimes(fd, ftimes);
+
		futimens(fd, ts);
	}
	close(fd);

@@ -315,17 +315,17 @@ cleanup:
	free(fakerepo);

	if (retcode == EPKG_OK) {
-
		struct timeval ftimes[2] = {
+
		struct timespec ts[2] = {
			{
			.tv_sec = fi->mtime,
-
			.tv_usec = 0
+
			.tv_nsec = 0
			},
			{
			.tv_sec = fi->mtime,
-
			.tv_usec = 0
+
			.tv_nsec = 0
			}
		};
-
		futimes(dest, ftimes);
+
		futimens(dest, ts);
	}

	return (retcode);
modified libpkg/pkg_audit.c
@@ -207,12 +207,12 @@ pkg_audit_fetch(const char *src, const char *dest)
	struct stat st;
	struct pkg_audit_extract_cbdata cbdata;
	int dfd = -1;
-
	struct timeval tm[2] = {
+
	struct timespec ts[2] = {
		{
-
		.tv_usec = 0
+
		.tv_nsec = 0
		},
		{
-
		.tv_usec = 0
+
		.tv_nsec = 0
		}
	};

@@ -272,9 +272,9 @@ pkg_audit_fetch(const char *src, const char *dest)

	/* Call sandboxed */
	retcode = pkg_emit_sandbox_call(pkg_audit_sandboxed_extract, fd, &cbdata);
-
	tm[0].tv_sec = st.st_mtim.tv_sec;
-
	tm[1].tv_sec = st.st_mtim.tv_sec;
-
	futimes(outfd, tm);
+
	ts[0].tv_sec = st.st_mtim.tv_sec;
+
	ts[1].tv_sec = st.st_mtim.tv_sec;
+
	futimens(outfd, ts);

cleanup:
	unlink(tmp);