diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-01-29 22:07:48 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-01-29 22:07:48 +0530 |
commit | 0ae1ef656c617e0b4c19180f989e082dc9d10783 (patch) | |
tree | 6553163b7fa7b6a88a79123228ce5ec967321762 | |
parent | 725349976a2a5144f34d7bd7332444a53bbf81ac (diff) | |
download | nnn-0ae1ef656c617e0b4c19180f989e082dc9d10783.tar.gz |
Read before write
-rw-r--r-- | src/nnn.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -2519,9 +2519,10 @@ static int dentfill(char *path, struct entry **dents) /* Flag if this is a dir or symlink to a dir */ if (S_ISDIR(sb.st_mode)) dentp->flags |= DIR_OR_LINK_TO_DIR; - else if (!S_ISLNK(sb.st_mode)) - dentp->flags &= ~DIR_OR_LINK_TO_DIR; - else { + else if (!S_ISLNK(sb.st_mode)) { + if (dentp->flags & DIR_OR_LINK_TO_DIR) + dentp->flags &= ~DIR_OR_LINK_TO_DIR; + } else { if (!fstatat(fd, namep, &sb, 0)) { if (S_ISDIR(sb.st_mode)) dentp->flags |= DIR_OR_LINK_TO_DIR; |