[openssh-commits] [openssh] 05/05: upstream: don't try to use timespeccmp(3) directly as a qsort(3)
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Jan 8 13:50:57 AEDT 2021
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 64ddd0fe68c4a7acf99b78624f8af45e919cd317
Author: djm at openbsd.org <djm at openbsd.org>
Date: Fri Jan 8 02:44:14 2021 +0000
upstream: don't try to use timespeccmp(3) directly as a qsort(3)
comparison function - it returns 0/1 and not the -1/0/1 that qsort expectes.
fixes sftp "ls -ltr" under some circumstances.
Based on patch by Masahiro Matsuya via bz3248.
OpenBSD-Commit-ID: 65b5e9f18bb0d10573868c3516de6e5170adb163
---
sftp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sftp.c b/sftp.c
index 248d4521..fb3c08d1 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.205 2020/12/04 02:41:10 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.206 2021/01/08 02:44:14 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
*
@@ -891,7 +891,10 @@ sglob_comp(const void *aa, const void *bb)
return (rmul * strcmp(ap, bp));
else if (sort_flag & LS_TIME_SORT) {
#if defined(HAVE_STRUCT_STAT_ST_MTIM)
- return (rmul * timespeccmp(&as->st_mtim, &bs->st_mtim, <));
+ if (timespeccmp(&as->st_mtim, &bs->st_mtim, ==))
+ return 0;
+ return timespeccmp(&as->st_mtim, &bs->st_mtim, <) ?
+ rmul : -rmul;
#elif defined(HAVE_STRUCT_STAT_ST_MTIME)
return (rmul * NCMP(as->st_mtime, bs->st_mtime));
#else
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list