]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/limits.c: setup_limits(): Simplify, by calling str2i(mode_t, ) instead of str2ul()
authorAlejandro Colomar <alx@kernel.org>
Tue, 9 Jan 2024 19:03:58 +0000 (20:03 +0100)
committerAlejandro Colomar <alx@kernel.org>
Tue, 2 Jul 2024 20:52:31 +0000 (22:52 +0200)
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/limits.c

index 6d3a3037c93e6af7b82e9a572c5c314f8e793c40..6c1a97f634b87e0050f7ff3c1fcf2faa753f9bb4 100644 (file)
@@ -507,10 +507,9 @@ void setup_limits (const struct passwd *info)
                                continue;
                        }
                        if (strncmp (cp, "umask=", 6) == 0) {
-                               unsigned long  mask;
+                               mode_t  mask;
 
-                               if (   (str2ul(&mask, cp + 6) == -1)
-                                   || (mask != (mode_t) mask)) {
+                               if (str2i(mode_t, &mask, cp + 6) == -1) {
                                        SYSLOG ((LOG_WARN,
                                                 "Can't set umask value for user %s",
                                                 info->pw_name));