]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homework: cleanup use of ERRNO_IS_NOT_SUPPORTED()
authorDmitry V. Levin <ldv@strace.io>
Fri, 14 Jul 2023 08:00:00 +0000 (08:00 +0000)
committerDmitry V. Levin <ldv@strace.io>
Fri, 28 Jul 2023 12:28:35 +0000 (12:28 +0000)
Given that ERRNO_IS_NOT_SUPPORTED() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_NOT_SUPPORTED() is the
value returned by home_update_quota_auto() which is not expected to
return any positive values, but let's be consistent anyway and move
the ERRNO_IS_NOT_SUPPORTED() invocation to the branch where
the return value is known to be negative.

src/home/homework-directory.c

index 6668edb7491028790798d6f82b91de5057c80aef..575ac525512086c4c288ac0f3777d91334361853 100644 (file)
@@ -285,10 +285,11 @@ int home_resize_directory(
                 return r;
 
         r = home_update_quota_auto(h, NULL);
-        if (ERRNO_IS_NOT_SUPPORTED(r))
-                return -ESOCKTNOSUPPORT; /* make recognizable */
-        if (r < 0)
+        if (r < 0) {
+                if (ERRNO_IS_NOT_SUPPORTED(r))
+                        return -ESOCKTNOSUPPORT; /* make recognizable */
                 return r;
+        }
 
         r = home_store_embedded_identity(new_home, setup->root_fd, h->uid, embedded_home);
         if (r < 0)