summaryrefslogtreecommitdiff
path: root/pkg/openbsd/patch/0039-pax-Only-use-_PC_TIMESTAMP_RESOLUTION-if-it-is-defin.patch
blob: d10806a8393cb20c18054b6b00cb42be3b83a6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 7977b9211356095517951e86fa53f64c6b27e16b Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Tue, 29 Apr 2025 16:50:16 -0700
Subject: [PATCH] pax: Only use _PC_TIMESTAMP_RESOLUTION if it is defined

---
 bin/pax/ar_subs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c
index 4c49efa1362..a0e4fdfdea5 100644
--- a/bin/pax/ar_subs.c
+++ b/bin/pax/ar_subs.c
@@ -167,12 +167,13 @@ cmp_file_times(int mtime_flag, int ctime_flag, ARCHD *arcn, const char *path)
 	else if (timespeccmp(&arcn->sb.st_mtim, &sb.st_mtim, <=))
 		return 1;
 
+#ifdef _PC_TIMESTAMP_RESOLUTION
 	/*
 	 * If we got here then the target arcn > sb for mtime *and* that's
 	 * the deciding factor.  Check whether they're equal after rounding
 	 * down the arcn mtime to the precision of the target path.
 	 */
-	res = pathconfat(AT_FDCWD, path, _PC_TIMESTAMP_RESOLUTION,
+	res = pathconf(path, _PC_TIMESTAMP_RESOLUTION,
 	    AT_SYMLINK_NOFOLLOW);
 	if (res == -1)
 		return 0;
@@ -195,6 +196,9 @@ cmp_file_times(int mtime_flag, int ctime_flag, ARCHD *arcn, const char *path)
 		return ((arcn->sb.st_mtime / res) * res) <= sb.st_mtime;
 		return arcn->sb.st_mtime <= ((sb.st_mtime / res) * res);
 	}
+#else
+	return 0;
+#endif
 }
 
 /*
-- 
2.49.0