]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/logindefs: fix compiler warning [-Werror=format-truncation=]
authorKarel Zak <kzak@redhat.com>
Mon, 6 Jun 2022 14:14:14 +0000 (16:14 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Jul 2022 16:05:39 +0000 (18:05 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/logindefs.c

index ee35f6cae7aefd6ed7fa80c25127056ede45b25d..95631223aae45a8d95dc66c2a928e3cb8fbf5e2a 100644 (file)
@@ -521,7 +521,8 @@ int get_hushlogin_status(struct passwd *pwd, int force_check)
                if (strlen(pwd->pw_dir) + strlen(file) + 2 > sizeof(buf))
                        continue;
 
-               snprintf(buf, sizeof(buf), "%s/%s", pwd->pw_dir, file);
+               if (snprintf(buf, sizeof(buf), "%s/%s", pwd->pw_dir, file) < 0)
+                       continue;
 
                if (force_check) {
                        uid_t ruid = getuid();