diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2010-11-09 18:47:16 -0800 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2010-11-09 18:51:36 -0800 |
commit | 892cacef43b4871d8ce50b2e61a143ede1b3083e (patch) | |
tree | c0ce19489aee729a0b8ee471d633a62169e73cb5 | |
parent | 12b2412c5217b105a86ccda57f261a33fcfd4d62 (diff) |
Check for getinfo errors before setting attributes
-rw-r--r-- | src/xattr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xattr.c b/src/xattr.c index eb244f852..e03509680 100644 --- a/src/xattr.c +++ b/src/xattr.c @@ -31,7 +31,7 @@ #include <sys/xattr.h> /* include header from libc, not from libattr */ /* mapping table of curl metadata to extended attribute names */ -static struct xattr_mapping { +static const struct xattr_mapping { const char *attr; /* name of the xattr */ CURLINFO info; } mappings[] = { @@ -50,11 +50,11 @@ int write_xattr(CURL *curl, const char *filename) { int i = 0; int err = 0; - /* loop through all xattr-curlinfo pairs and abort on error */ + /* loop through all xattr-curlinfo pairs and abort on a set error */ while ( err == 0 && mappings[i].attr != NULL ) { char *value = NULL; - curl_easy_getinfo(curl, mappings[i].info, &value); - if (value) { + CURLcode rc = curl_easy_getinfo(curl, mappings[i].info, &value); + if ( rc == CURLE_OK && value ) { err = setxattr( filename, mappings[i].attr, value, strlen(value), 0 ); } i++; |