From ba5af691f91ba5595b2b291b2445bf0222a5b222 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 4 Oct 2015 18:59:51 +0200 Subject: [PATCH] Add find(1) symbolic link support. --- utils/find.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/find.cpp b/utils/find.cpp index d06813eb..d4505650 100644 --- a/utils/find.cpp +++ b/utils/find.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2013. + Copyright(C) Jonas 'Sortie' Termansen 2013, 2015. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -53,7 +53,7 @@ const int TYPE_DIR = 1 << 1; bool Find(int dirfd, const char* relpath, const char* path, int types) { bool ret = true; - int fd = openat(dirfd, relpath, O_RDONLY); + int fd = openat(dirfd, relpath, O_RDONLY | O_SYMLINK_NOFOLLOW); if ( fd < 0 ) { error(0, errno, "%s", path); return false; } struct stat st; if ( fstat(fd, &st) ) { error(0, errno, "stat: %s", path); return false; }