diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-10-21 19:27:29 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-10-21 19:27:29 +0100 |
commit | f047077aa2015b6b7cf2fe9dc0508029588fd741 (patch) | |
tree | 2beb5a1623178a6c7a0a361f887343b8e82fba66 | |
parent | b20d48b7c1cab77d0ba7950cab4cb0163d99b396 (diff) | |
download | summain-f047077aa2015b6b7cf2fe9dc0508029588fd741.tar.gz |
Handle empty extended attribute values
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | _summainmodule.c | 2 | ||||
-rwxr-xr-x | tests/xattrs.script | 3 |
3 files changed, 5 insertions, 2 deletions
@@ -6,6 +6,8 @@ Version X.Y, released UNRELEASED * Changed to use the libc-provided xattr library, instead of the external one. Thanks, Игорь Пашев for pointing this out. +* Fixed bug: Summain can now handle extended attributes with an empty + value. Version 0.16, released 2012-09-29 --------------------------------- diff --git a/_summainmodule.c b/_summainmodule.c index 069dafe..998469a 100644 --- a/_summainmodule.c +++ b/_summainmodule.c @@ -116,7 +116,7 @@ lgetxattr_wrapper(PyObject *self, PyObject *args) char *buf = malloc(bufsize); ssize_t n = lgetxattr(filename, attrname, buf, bufsize); - if (n > 0) + if (n >= 0) o = Py_BuildValue("s#", buf, (int) n); else if (n == -1 && errno != ERANGE) o = Py_BuildValue("i", errno); diff --git a/tests/xattrs.script b/tests/xattrs.script index 3f66b00..1d64954 100755 --- a/tests/xattrs.script +++ b/tests/xattrs.script @@ -5,7 +5,8 @@ set -e umask 0002 mkdir -m 0775 "$DATADIR/xattrs" touch "$DATADIR/xattrs/file" -if setfattr -n user.foo -v bar "$DATADIR/xattrs/file" 2> /dev/null +if setfattr -n user.foo -v bar "$DATADIR/xattrs/file" 2> /dev/null && + setfattr -n user.empty -v '""' "$DATADIR/xattrs/file" 2> /dev/null then ./summain --exclude=mtime --exclude=uid --exclude=username \ --exclude=gid --exclude=group --exclude=ino --exclude=dev \ |