Fix mtime comparison

This commit is contained in:
Arun Prakash Jana 2019-07-11 22:33:49 +05:30
parent 201b1ae571
commit 406faf63d9
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 6 additions and 11 deletions

View File

@ -1486,28 +1486,23 @@ static int entrycmp(const void *va, const void *vb)
if ((pb->flags & DIR_OR_LINK_TO_DIR) != (pa->flags & DIR_OR_LINK_TO_DIR)) {
if (pb->flags & DIR_OR_LINK_TO_DIR)
return 1;
return -1;
}
/* Do the actual sorting */
/* Sort based on specified order */
if (cfg.mtimeorder) {
if (pb->t >= pa->t)
return (int)(pb->t - pa->t);
return -1;
}
if (cfg.sizeorder) {
if (pb->t > pa->t)
return 1;
if (pb->t < pa->t)
return -1;
} else if (cfg.sizeorder) {
if (pb->size > pa->size)
return 1;
if (pb->size < pa->size)
return -1;
} else if (cfg.blkorder) {
if (pb->blocks > pa->blocks)
return 1;
if (pb->blocks < pa->blocks)
return -1;
}