logo

skeud

Simple and portable utilities to deal with user accounts (su, login)
commit: cd224ae0f86b3ae35e2b79787e431667f59fccd6
parent 8e4b48bb1928298fa5e5193541005915523edb0d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun,  9 Oct 2022 03:18:15 +0200

su,login: -p doesn't requires an operand

Diffstat:

Mlogin.c4++--
Msu.c5++---
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/login.c b/login.c @@ -41,7 +41,7 @@ main(int argc, char *argv[]) } /* flawfinder: ignore CWE-120, CWE-20 */ - while((c = getopt(argc, argv, ":f:p:")) != EOF) + while((c = getopt(argc, argv, ":f:p")) != EOF) { switch(c) { @@ -49,7 +49,7 @@ main(int argc, char *argv[]) opt_f = true; username = optarg; break; - case 'p': // preseve environment + case 'p': // preserve environment opt_p = true; break; case ':': diff --git a/su.c b/su.c @@ -41,7 +41,7 @@ main(int argc, char *argv[]) } /* flawfinder: ignore CWE-120, CWE-20 */ - while((c = getopt(argc, argv, ":l:s:p:")) != EOF) + while((c = getopt(argc, argv, ":l:s:p")) != EOF) { switch(c) { @@ -52,7 +52,7 @@ main(int argc, char *argv[]) case 's': // shell shell = optarg; break; - case 'p': // preseve environment + case 'p': // preserve environment opt_p = true; break; case ':': @@ -69,7 +69,6 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - (void)argv; if((opt_l && argc > 0) || argc > 1) {