Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
utimensat: replace deprecated futimesat
Baptiste Daroussin committed 1 year ago
commit f582afcbf59afd030909c4853c97fad851356d9e
parent 361b114
2 files changed +14 -14
modified libpkg/pkg_repo_create.c
@@ -678,27 +678,27 @@ pkg_repo_create_pack_and_sign(struct pkg_repo_create *prc)
	pkg_emit_progress_tick(nfile++, files_to_pack);

	if (fstatat(prc->ofd, "meta.conf", &st, 0) == 0) {
-
		struct timeval ftimes[2] = {
+
		struct timespec ts[2] = {
			{
-
			.tv_sec = st.st_mtime,
-
			.tv_usec = 0
+
				.tv_sec = st.st_mtime,
+
				.tv_nsec = 0,
			},
			{
-
			.tv_sec = st.st_mtime,
-
			.tv_usec = 0
-
			}
+
				.tv_sec = st.st_mtime,
+
				.tv_nsec = 0,
+
			},
		};
		snprintf(repo_archive, sizeof(repo_archive), "%s.pkg",
		    prc->meta->manifests_archive);
-
		futimesat(prc->ofd, repo_archive, ftimes);
+
		utimensat(prc->ofd, repo_archive, ts, 0);
		if (prc->filelist) {
			snprintf(repo_archive, sizeof(repo_archive),
			    "%s.pkg", prc->meta->filesite_archive);
-
			futimesat(prc->ofd, repo_archive, ftimes);
+
			utimensat(prc->ofd, repo_archive, ts, 0);
		}
		snprintf(repo_archive, sizeof(repo_archive), "%s.pkg",
		    prc->meta->data_archive);
-
		futimesat(prc->ofd, repo_archive, ftimes);
+
		utimensat(prc->ofd, repo_archive, ts, 0);
	}

cleanup:
modified libpkg/repo/binary/update.c
@@ -763,20 +763,20 @@ cleanup:

	/* Set mtime from http request if possible */
	if (t != 0 && res == EPKG_OK) {
-
		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
			}
		};

-
		utimes(filename, ftimes);
+
		utimensat(AT_FDCWD, filename, ts, 0);
		if (got_meta)
-
			futimesat(repo->dfd, "meta", ftimes);
+
			utimensat(repo->dfd, "meta", ts, 0);
	}

	if (repo->priv != NULL)