From d9e1f42401468ecaa3a1f51cf3e32f25b107bd4d Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 14 Jul 2023 08:00:00 +0000 Subject: [PATCH] homework: cleanup use of ERRNO_IS_NOT_SUPPORTED() 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/home/homework-directory.c b/src/home/homework-directory.c index 6668edb749..575ac52551 100644 --- a/src/home/homework-directory.c +++ b/src/home/homework-directory.c @@ -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) -- 2.25.1