]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
usermod: Remove special case for "" 455/head
authorAlejandro Colomar <alx.manpages@gmail.com>
Tue, 14 Dec 2021 11:40:06 +0000 (12:40 +0100)
committerAlejandro Colomar <alx.manpages@gmail.com>
Tue, 14 Dec 2021 11:40:09 +0000 (12:40 +0100)
That special case is already handled by the called function: strtoday()
so we can simplify the calling code.

Link: <https://github.com/shadow-maint/shadow/issues/454>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
src/usermod.c

index 1069be1e1a14546c36ea1c0565aa7d2e47ee4257..af3ce9b762f35b2c7f72131aa01a08a58cdb81c4 100644 (file)
@@ -1073,18 +1073,14 @@ static void process_flags (int argc, char **argv)
                                }
                                break;
                        case 'e':
-                               if ('\0' != *optarg) {
-                                       user_newexpire = strtoday (optarg);
-                                       if (user_newexpire < -1) {
-                                               fprintf (stderr,
-                                                        _("%s: invalid date '%s'\n"),
-                                                        Prog, optarg);
-                                               exit (E_BAD_ARG);
-                                       }
-                                       user_newexpire *= DAY / SCALE;
-                               } else {
-                                       user_newexpire = -1;
+                               user_newexpire = strtoday (optarg);
+                               if (user_newexpire < -1) {
+                                       fprintf (stderr,
+                                                _("%s: invalid date '%s'\n"),
+                                                Prog, optarg);
+                                       exit (E_BAD_ARG);
                                }
+                               user_newexpire *= DAY / SCALE;
                                eflg = true;
                                break;
                        case 'f':