]> granicus.if.org Git - curl/commitdiff
curl: fix FreeBSD compiler warning in the --xattr code
authorDaniel Stenberg <daniel@haxx.se>
Mon, 11 Feb 2019 09:09:18 +0000 (10:09 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 11 Feb 2019 10:42:21 +0000 (11:42 +0100)
Closes #3550

src/tool_xattr.c

index 730381ba9400addcb24e888c04c6ea77c429e03b..be5f024a6a19d4410b0f8b9e6a752965896730a2 100644 (file)
@@ -111,11 +111,13 @@ int fwrite_xattr(CURL *curl, int fd)
 #elif defined(HAVE_FSETXATTR_5)
         err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0);
 #elif defined(__FreeBSD_version)
-        err = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, mappings[i].attr,
-                             value, strlen(value));
-        /* FreeBSD's extattr_set_fd returns the length of the extended
-           attribute */
-        err = err < 0 ? err : 0;
+        {
+          ssize_t rc = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER,
+                                      mappings[i].attr, value, strlen(value));
+          /* FreeBSD's extattr_set_fd returns the length of the extended
+             attribute */
+          err = (int)rc;
+        }
 #endif
         if(freeptr)
           curl_free(value);