summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-11-23 16:26:29 +0100
committerAndreas Gruenbacher <agruen@suse.de>2010-11-23 16:26:29 +0100
commitb5b7cad792b9e7039a1f9614c16f8d4872971ee9 (patch)
tree148adfa47dba8c57e18cd8b1f563ef1bb65373ba
parent220ae4e9daec573921542e408e489f8d270fffa0 (diff)
parente8d568c696692eed5c92d5a35498e1c26e13d6b3 (diff)
downloadattr-b5b7cad792b9e7039a1f9614c16f8d4872971ee9.tar.gz
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/attr
-rw-r--r--include/walk_tree.h9
-rw-r--r--libattr/attr_copy_action.c13
-rw-r--r--libmisc/quote.c1
-rw-r--r--libmisc/walk_tree.c4
-rw-r--r--m4/package_utilies.m453
-rw-r--r--setfattr/setfattr.c2
6 files changed, 32 insertions, 50 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/libattr/attr_copy_action.c b/libattr/attr_copy_action.c
index 0d7aca5..2697328 100644
--- a/libattr/attr_copy_action.c
+++ b/libattr/attr_copy_action.c
@@ -53,7 +53,7 @@ free_attr_actions(void)
static int
attr_parse_attr_conf(struct error_context *ctx)
{
- char *text, *t;
+ char *text = NULL, *t;
size_t size_guess = 4096, len;
FILE *file;
char *pattern = NULL;
@@ -64,15 +64,16 @@ attr_parse_attr_conf(struct error_context *ctx)
return 0;
repeat:
- text = malloc(size_guess + 1);
- if (!text)
- goto fail;
-
if ((file = fopen(ATTR_CONF, "r")) == NULL) {
if (errno == ENOENT)
return 0;
goto fail;
}
+
+ text = malloc(size_guess + 1);
+ if (!text)
+ goto fail;
+
len = fread(text, 1, size_guess, file);
if (ferror(file))
goto fail;
@@ -80,6 +81,7 @@ repeat:
fclose(file);
file = NULL;
free(text);
+ text = NULL;
size_guess *= 2;
goto repeat;
}
@@ -128,6 +130,7 @@ repeat:
t += strcspn(t, "\n");
}
+ free(text);
return 0;
parse_error:
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);
diff --git a/m4/package_utilies.m4 b/m4/package_utilies.m4
index 165db35..551c142 100644
--- a/m4/package_utilies.m4
+++ b/m4/package_utilies.m4
@@ -36,55 +36,38 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
AC_SUBST(cc)
AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
- if test -z "$MAKE"; then
- AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
- fi
- if test -z "$MAKE"; then
- AC_PATH_PROG(MAKE, make,, /usr/bin)
- fi
+ search_path="$PATH$PATH_SEPARATOR/usr/freeware/bin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR/usr/local/bin"
+
+ AC_PATH_PROGS(MAKE, gmake make,, $search_path)
make=$MAKE
AC_SUBST(make)
AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
- if test -z "$TAR"; then
- AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
- fi
+ AC_PATH_PROG(TAR, tar,, $search_path)
tar=$TAR
AC_SUBST(tar)
- if test -z "$ZIP"; then
- AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin:/usr/freeware/bin)
- fi
+ AC_PATH_PROG(ZIP, gzip,, $search_path)
zip=$ZIP
AC_SUBST(zip)
- if test -z "$MAKEDEPEND"; then
- AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
- fi
+ AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
makedepend=$MAKEDEPEND
AC_SUBST(makedepend)
- if test -z "$AWK"; then
- AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
- fi
+ AC_PATH_PROG(AWK, awk,, $search_path)
awk=$AWK
AC_SUBST(awk)
- if test -z "$SED"; then
- AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
- fi
+ AC_PATH_PROG(SED, sed,, $search_path)
sed=$SED
AC_SUBST(sed)
- if test -z "$ECHO"; then
- AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
- fi
+ AC_PATH_PROG(ECHO, echo,, $search_path)
echo=$ECHO
AC_SUBST(echo)
- if test -z "$SORT"; then
- AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
- fi
+ AC_PATH_PROG(SORT, sort,, $search_path)
sort=$SORT
AC_SUBST(sort)
@@ -92,23 +75,17 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
AC_PROG_LN_S
if test "$enable_gettext" = yes; then
- if test -z "$MSGFMT"; then
- AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
- fi
+ AC_PATH_PROG(MSGFMT, msgfmt,, $search_path)
msgfmt=$MSGFMT
AC_SUBST(msgfmt)
AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
- if test -z "$MSGMERGE"; then
- AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
- fi
+ AC_PATH_PROG(MSGMERGE, msgmerge,, $search_path)
msgmerge=$MSGMERGE
AC_SUBST(msgmerge)
AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
- if test -z "$XGETTEXT"; then
- AC_PATH_PROG(XGETTEXT, xgettext,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
- fi
+ AC_PATH_PROG(XGETTEXT, xgettext,, $search_path)
xgettext=$XGETTEXT
AC_SUBST(xgettext)
AC_PACKAGE_NEED_UTILITY($1, "$xgettext", xgettext, gettext)
@@ -116,9 +93,7 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
AC_DEFINE([ENABLE_GETTEXT], 1, [enable gettext])
fi
- if test -z "$RPM"; then
- AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin:/usr/freeware/bin)
- fi
+ AC_PATH_PROG(RPM, rpm,, $search_path)
rpm=$RPM
AC_SUBST(rpm)
diff --git a/setfattr/setfattr.c b/setfattr/setfattr.c
index 491c25a..0a14cfa 100644
--- a/setfattr/setfattr.c
+++ b/setfattr/setfattr.c
@@ -120,7 +120,7 @@ int restore(const char *filename)
break;
line++;
if (strncmp(l, "# file: ", 8) != 0) {
- if (filename) {
+ if (file != stdin) {
fprintf(stderr, _("%s: %s: No filename found "
"in line %d, aborting\n"),
progname, filename, backup_line);