diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | defines.h | 7 | ||||
-rw-r--r-- | includes.h | 3 | ||||
-rw-r--r-- | sftp.c | 10 |
4 files changed, 20 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 46f7d4957..18079acba 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -3814,6 +3814,8 @@ OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX]) | |||
3814 | OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX]) | 3814 | OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX]) |
3815 | 3815 | ||
3816 | AC_CHECK_MEMBERS([struct stat.st_blksize]) | 3816 | AC_CHECK_MEMBERS([struct stat.st_blksize]) |
3817 | AC_CHECK_MEMBERS([struct stat.st_mtim]) | ||
3818 | AC_CHECK_MEMBERS([struct stat.st_mtime]) | ||
3817 | AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class, | 3819 | AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class, |
3818 | struct passwd.pw_change, struct passwd.pw_expire], | 3820 | struct passwd.pw_change, struct passwd.pw_expire], |
3819 | [], [], [[ | 3821 | [], [], [[ |
@@ -519,6 +519,13 @@ struct winsize { | |||
519 | } | 519 | } |
520 | #endif | 520 | #endif |
521 | 521 | ||
522 | #ifndef timespeccmp | ||
523 | #define timespeccmp(tsp, usp, cmp) \ | ||
524 | (((tsp)->tv_sec == (usp)->tv_sec) ? \ | ||
525 | ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ | ||
526 | ((tsp)->tv_sec cmp (usp)->tv_sec)) | ||
527 | #endif | ||
528 | |||
522 | #ifndef __P | 529 | #ifndef __P |
523 | # define __P(x) x | 530 | # define __P(x) x |
524 | #endif | 531 | #endif |
diff --git a/includes.h b/includes.h index 497a038b2..0fd71792e 100644 --- a/includes.h +++ b/includes.h | |||
@@ -93,6 +93,9 @@ | |||
93 | #ifdef HAVE_SYS_SYSMACROS_H | 93 | #ifdef HAVE_SYS_SYSMACROS_H |
94 | # include <sys/sysmacros.h> /* For MIN, MAX, etc */ | 94 | # include <sys/sysmacros.h> /* For MIN, MAX, etc */ |
95 | #endif | 95 | #endif |
96 | #ifdef HAVE_SYS_TIME_H | ||
97 | # include <sys/time.h> /* for timespeccmp if present */ | ||
98 | #endif | ||
96 | #ifdef HAVE_SYS_MMAN_H | 99 | #ifdef HAVE_SYS_MMAN_H |
97 | #include <sys/mman.h> /* for MAP_ANONYMOUS */ | 100 | #include <sys/mman.h> /* for MAP_ANONYMOUS */ |
98 | #endif | 101 | #endif |
@@ -894,9 +894,15 @@ sglob_comp(const void *aa, const void *bb) | |||
894 | #define NCMP(a,b) (a == b ? 0 : (a < b ? 1 : -1)) | 894 | #define NCMP(a,b) (a == b ? 0 : (a < b ? 1 : -1)) |
895 | if (sort_flag & LS_NAME_SORT) | 895 | if (sort_flag & LS_NAME_SORT) |
896 | return (rmul * strcmp(ap, bp)); | 896 | return (rmul * strcmp(ap, bp)); |
897 | else if (sort_flag & LS_TIME_SORT) | 897 | else if (sort_flag & LS_TIME_SORT) { |
898 | #if defined(HAVE_STRUCT_STAT_ST_MTIM) | ||
898 | return (rmul * timespeccmp(&as->st_mtim, &bs->st_mtim, <)); | 899 | return (rmul * timespeccmp(&as->st_mtim, &bs->st_mtim, <)); |
899 | else if (sort_flag & LS_SIZE_SORT) | 900 | #elif defined(HAVE_STRUCT_STAT_ST_MTIME) |
901 | return (rmul * NCMP(as->st_mtime, bs->st_mtime)); | ||
902 | #else | ||
903 | return rmul * 1; | ||
904 | #endif | ||
905 | } else if (sort_flag & LS_SIZE_SORT) | ||
900 | return (rmul * NCMP(as->st_size, bs->st_size)); | 906 | return (rmul * NCMP(as->st_size, bs->st_size)); |
901 | 907 | ||
902 | fatal("Unknown ls sort type"); | 908 | fatal("Unknown ls sort type"); |