9
0
Fork 0

recursive_action: add ACTION_FOLLOWLINKS support

this is need to support symlink in envfs

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-08-22 12:53:00 +08:00
parent dccdc2ed88
commit f7edad7cbf
3 changed files with 8 additions and 3 deletions

View File

@ -14,7 +14,7 @@ char* last_char_is(const char *s, int c);
enum {
ACTION_RECURSE = (1 << 0),
/* ACTION_FOLLOWLINKS = (1 << 1), - unused */
ACTION_FOLLOWLINKS = (1 << 1),
ACTION_DEPTHFIRST = (1 << 2),
/*ACTION_REVERSE = (1 << 3), - unused */
};

View File

@ -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",

View File

@ -73,7 +73,7 @@ char* last_char_is(const char *s, int c)
enum {
ACTION_RECURSE = (1 << 0),
/* ACTION_FOLLOWLINKS = (1 << 1), - unused */
ACTION_FOLLOWLINKS = (1 << 1),
ACTION_DEPTHFIRST = (1 << 2),
/*ACTION_REVERSE = (1 << 3), - unused */
};