tmpfiles: avoid using wrong type for strlen() result
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Jan 2018 14:31:50 +0000 (15:31 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 22 Jan 2018 14:31:50 +0000 (15:31 +0100)
The result of strlen is size_t, hence let's not store it in an "int"
just to pass it on as as size_t right-away. In fact let's not store it
at all…

src/tmpfiles/tmpfiles.c

index 128abb8..f96f400 100644 (file)
@@ -877,11 +877,8 @@ static int path_set_xattrs(Item *i, const char *path) {
         assert(path);
 
         STRV_FOREACH_PAIR(name, value, i->xattrs) {
-                int n;
-
-                n = strlen(*value);
                 log_debug("Setting extended attribute '%s=%s' on %s.", *name, *value, path);
-                if (lsetxattr(path, *name, *value, n, 0) < 0)
+                if (lsetxattr(path, *name, *value, strlen(*value), 0) < 0)
                         return log_error_errno(errno, "Setting extended attribute %s=%s on %s failed: %m",
                                                *name, *value, path);
         }