summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Philips <brandon@ifup.org>2010-01-22 14:55:20 -0800
committerBrandon Philips <brandon@ifup.org>2010-01-22 14:55:20 -0800
commitbe0671a9e2529c74020819e3c38101bc52c1a40d (patch)
treea25329293caabef49c72d23444e45a3620d06d9f
parent972b42a67393f762936e74d3ce929914181f5f28 (diff)
parent235cdd2af498d288f1af1142e7a23fbd16dff907 (diff)
downloadattr-be0671a9e2529c74020819e3c38101bc52c1a40d.tar.gz
Merge branch 'misc'
-rw-r--r--include/walk_tree.h9
-rw-r--r--libmisc/quote.c1
-rw-r--r--libmisc/walk_tree.c4
3 files changed, 9 insertions, 5 deletions
diff --git a/include/walk_tree.h b/include/walk_tree.h
index 53a8fc5..9f1ec34 100644
--- a/include/walk_tree.h
+++ b/include/walk_tree.h
@@ -20,10 +20,11 @@
#ifndef __WALK_TREE_H
#define __WALK_TREE_H
-#define WALK_TREE_RECURSIVE 0x1
-#define WALK_TREE_PHYSICAL 0x2
-#define WALK_TREE_LOGICAL 0x4
-#define WALK_TREE_DEREFERENCE 0x8
+#define WALK_TREE_RECURSIVE 0x01
+#define WALK_TREE_PHYSICAL 0x02
+#define WALK_TREE_LOGICAL 0x04
+#define WALK_TREE_DEREFERENCE 0x08
+#define WALK_TREE_DEREFERENCE_TOPLEVEL 0x10
#define WALK_TREE_TOPLEVEL 0x100
#define WALK_TREE_SYMLINK 0x200
diff --git a/libmisc/quote.c b/libmisc/quote.c
index f98c887..bf8f9eb 100644
--- a/libmisc/quote.c
+++ b/libmisc/quote.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <string.h>
#include "misc.h"
const char *quote(const char *str, const char *quote_chars)
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
index 2777145..30ff92a 100644
--- a/libmisc/walk_tree.c
+++ b/libmisc/walk_tree.c
@@ -78,7 +78,9 @@ static int walk_tree_rec(const char *path, int walk_flags,
return func(path, NULL, flags | WALK_TREE_FAILED, arg);
if (S_ISLNK(st.st_mode)) {
flags |= WALK_TREE_SYMLINK;
- if (flags & WALK_TREE_DEREFERENCE) {
+ if ((flags & WALK_TREE_DEREFERENCE) ||
+ ((flags & WALK_TREE_TOPLEVEL) &&
+ (flags & WALK_TREE_DEREFERENCE_TOPLEVEL))) {
if (stat(path, &st) != 0)
return func(path, NULL,
flags | WALK_TREE_FAILED, arg);