summaryrefslogtreecommitdiffstats
path: root/defines.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2017-06-10 15:41:25 +0200
committerDamien Miller <djm@mindrot.org>2017-06-10 15:41:25 +0200
commitbcd1485075aa72ba9418003f5cc27af2b049c51b (patch)
tree122b7024821c2c47b6df71639fe578bf5f571183 /defines.h
parentupstream commit (diff)
downloadopenssh-bcd1485075aa72ba9418003f5cc27af2b049c51b.tar.xz
openssh-bcd1485075aa72ba9418003f5cc27af2b049c51b.zip
portability for sftp globbed ls sort by mtime
Include replacement timespeccmp() for systems that lack it. Support time_t struct stat->st_mtime in addition to timespec stat->st_mtim, as well as unsorted fallback.
Diffstat (limited to 'defines.h')
-rw-r--r--defines.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/defines.h b/defines.h
index 0420a7e8e..f1662edcf 100644
--- a/defines.h
+++ b/defines.h
@@ -519,6 +519,13 @@ struct winsize {
}
#endif
+#ifndef timespeccmp
+#define timespeccmp(tsp, usp, cmp) \
+ (((tsp)->tv_sec == (usp)->tv_sec) ? \
+ ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
+ ((tsp)->tv_sec cmp (usp)->tv_sec))
+#endif
+
#ifndef __P
# define __P(x) x
#endif