summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-08-22 12:53:00 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-09-05 03:22:14 +0800
commitf7edad7cbf4560902083df5ecc912b2d3f91ba28 (patch)
tree59378467afda20c119940d89b6e5d2c2db3ea3e2 /lib
parentdccdc2ed8889a791bb5f8151286975ad8a94ec1f (diff)
downloadbarebox-f7edad7cbf4560902083df5ecc912b2d3f91ba28.tar.gz
barebox-f7edad7cbf4560902083df5ecc912b2d3f91ba28.tar.xz
recursive_action: add ACTION_FOLLOWLINKS support
this is need to support symlink in envfs Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/recursive_action.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/recursive_action.c b/lib/recursive_action.c
index 1ef758df61..5bc2595db9 100644
--- a/lib/recursive_action.c
+++ b/lib/recursive_action.c
@@ -54,14 +54,19 @@ int recursive_action(const char *fileName,
const unsigned depth)
{
struct stat statbuf;
+ unsigned follow;
int status;
DIR *dir;
struct dirent *next;
if (!fileAction) fileAction = true_action;
if (!dirAction) dirAction = true_action;
- status = stat(fileName, &statbuf);
+ follow = ACTION_FOLLOWLINKS;
+ if (depth == 0)
+ follow = ACTION_FOLLOWLINKS;
+ follow &= flags;
+ status = (follow ? stat : lstat)(fileName, &statbuf);
if (status < 0) {
#ifdef DEBUG_RECURS_ACTION
bb_error_msg("status=%d followLinks=%d TRUE=%d",