Add find(1) symbolic link support.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-10-04 18:59:51 +02:00
parent 4333b2e695
commit ba5af691f9
1 changed files with 2 additions and 2 deletions

View File

@ -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; }