mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
Read before write
This commit is contained in:
parent
725349976a
commit
0ae1ef656c
|
@ -2519,9 +2519,10 @@ static int dentfill(char *path, struct entry **dents)
|
||||||
/* Flag if this is a dir or symlink to a dir */
|
/* Flag if this is a dir or symlink to a dir */
|
||||||
if (S_ISDIR(sb.st_mode))
|
if (S_ISDIR(sb.st_mode))
|
||||||
dentp->flags |= DIR_OR_LINK_TO_DIR;
|
dentp->flags |= DIR_OR_LINK_TO_DIR;
|
||||||
else if (!S_ISLNK(sb.st_mode))
|
else if (!S_ISLNK(sb.st_mode)) {
|
||||||
|
if (dentp->flags & DIR_OR_LINK_TO_DIR)
|
||||||
dentp->flags &= ~DIR_OR_LINK_TO_DIR;
|
dentp->flags &= ~DIR_OR_LINK_TO_DIR;
|
||||||
else {
|
} else {
|
||||||
if (!fstatat(fd, namep, &sb, 0)) {
|
if (!fstatat(fd, namep, &sb, 0)) {
|
||||||
if (S_ISDIR(sb.st_mode))
|
if (S_ISDIR(sb.st_mode))
|
||||||
dentp->flags |= DIR_OR_LINK_TO_DIR;
|
dentp->flags |= DIR_OR_LINK_TO_DIR;
|
||||||
|
|
Loading…
Reference in a new issue