logo

utils-std

Collection of commonly available Unix tools
commit: d4bd229c22df3978c6e3a1ded88888ff94484e7d
parent 30a23b46897839a4be659fff24370384a599b657
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  8 Jun 2024 07:50:25 +0200

cmd/ln: Reset errno after fstatat

Diffstat:

Mcmd/ln.c1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/cmd/ln.c b/cmd/ln.c @@ -182,6 +182,7 @@ main(int argc, char *argv[]) int ret_stat = fstatat(AT_FDCWD, argv[1], &dest_status, AT_SYMLINK_NOFOLLOW); if(argc == 2 && (errno == ENOENT || (ret_stat == 0 && !S_ISDIR(dest_status.st_mode)))) { + errno = 0; int ret = do_link(argv[0], argv[1]); return ret < 0 ? 1 : 0;