Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/edit_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,10 @@ sudo_edit_openat_nofollow(int dfd, char *path, int oflags, mode_t mode)
* Check if path is a symlink. This is racey but we detect whether
* we lost the race in sudo_edit_is_symlink() after the open.
*/
if (lstat(path, &sb) == -1 && errno != ENOENT)
goto done;
if (S_ISLNK(sb.st_mode)) {
if (lstat(path, &sb) == -1) {
if (errno != ENOENT)
goto done;
} else if (S_ISLNK(sb.st_mode)) {
errno = ELOOP;
goto done;
}
Expand Down
Loading