diff options
author | Sami Kerola | 2017-02-11 21:23:26 +0100 |
---|---|---|
committer | Karel Zak | 2017-02-20 12:58:49 +0100 |
commit | 87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 (patch) | |
tree | 513541cfa347d7fc66e50137603489cb195c86de /login-utils | |
parent | cfdisk: avoid use of VLA in combination with sizeof() [smatch scan] (diff) | |
download | kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.gz kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.xz kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.zip |
misc: do not use plain 0 as NULL [smatch scan]
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/chfn.c | 14 | ||||
-rw-r--r-- | login-utils/chsh.c | 12 | ||||
-rw-r--r-- | login-utils/nologin.c | 6 | ||||
-rw-r--r-- | login-utils/su-common.c | 4 | ||||
-rw-r--r-- | login-utils/sulogin.c | 12 | ||||
-rw-r--r-- | login-utils/utmpdump.c | 12 |
6 files changed, 30 insertions, 30 deletions
diff --git a/login-utils/chfn.c b/login-utils/chfn.c index 7f00f79a3..faddd89a7 100644 --- a/login-utils/chfn.c +++ b/login-utils/chfn.c @@ -133,13 +133,13 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv) { int index, c, status = 0; static const struct option long_options[] = { - {"full-name", required_argument, 0, 'f'}, - {"office", required_argument, 0, 'o'}, - {"office-phone", required_argument, 0, 'p'}, - {"home-phone", required_argument, 0, 'h'}, - {"help", no_argument, 0, 'u'}, - {"version", no_argument, 0, 'v'}, - {NULL, no_argument, 0, '0'}, + { "full-name", required_argument, NULL, 'f' }, + { "office", required_argument, NULL, 'o' }, + { "office-phone", required_argument, NULL, 'p' }, + { "home-phone", required_argument, NULL, 'h' }, + { "help", no_argument, NULL, 'u' }, + { "version", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 }, }; while ((c = getopt_long(argc, argv, "f:r:p:h:o:uv", long_options, diff --git a/login-utils/chsh.c b/login-utils/chsh.c index c7defd49f..979a287fe 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -129,11 +129,11 @@ static int get_shell_list(const char *shell_name) static void parse_argv(int argc, char **argv, struct sinfo *pinfo) { static const struct option long_options[] = { - {"shell", required_argument, 0, 's'}, - {"list-shells", no_argument, 0, 'l'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {NULL, no_argument, 0, '0'}, + {"shell", required_argument, NULL, 's'}, + {"list-shells", no_argument, NULL, 'l'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, 0, NULL, 0}, }; int c; @@ -227,7 +227,7 @@ int main(int argc, char **argv) char *oldshell; int nullshell = 0; const uid_t uid = getuid(); - struct sinfo info = { 0 }; + struct sinfo info = { NULL }; struct passwd *pw; sanitize_env(); diff --git a/login-utils/nologin.c b/login-utils/nologin.c index cd62c3677..2e897cc72 100644 --- a/login-utils/nologin.c +++ b/login-utils/nologin.c @@ -41,9 +41,9 @@ int main(int argc, char *argv[]) int c, fd; struct stat st; static const struct option longopts[] = { - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/login-utils/su-common.c b/login-utils/su-common.c index 696adc888..41f2b1cea 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -793,8 +793,8 @@ su_main (int argc, char **argv, int mode) {"group", required_argument, NULL, 'g'}, {"supp-group", required_argument, NULL, 'G'}, {"user", required_argument, NULL, 'u'}, /* runuser only */ - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, {NULL, 0, NULL, 0} }; diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 5b8712bfe..b1e8c90f4 100644 --- a/login-utils/sulogin.c +++ b/login-utils/sulogin.c @@ -840,12 +840,12 @@ int main(int argc, char **argv) pid_t pid; static const struct option longopts[] = { - { "login-shell", 0, 0, 'p' }, - { "timeout", 1, 0, 't' }, - { "force", 0, 0, 'e' }, - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "login-shell", no_argument, NULL, 'p' }, + { "timeout", required_argument, NULL, 't' }, + { "force", no_argument, NULL, 'e' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; INIT_LIST_HEAD(&consoles); diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c index 8e4839346..02e13ea88 100644 --- a/login-utils/utmpdump.c +++ b/login-utils/utmpdump.c @@ -329,12 +329,12 @@ int main(int argc, char **argv) const char *filename = NULL; static const struct option longopts[] = { - { "follow", 0, 0, 'f' }, - { "reverse", 0, 0, 'r' }, - { "output", required_argument, 0, 'o' }, - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "follow", no_argument, NULL, 'f' }, + { "reverse", no_argument, NULL, 'r' }, + { "output", required_argument, NULL, 'o' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); |