diff options
author | Sami Kerola | 2016-07-03 14:20:30 +0200 |
---|---|---|
committer | Sami Kerola | 2016-07-21 22:14:33 +0200 |
commit | eb2306e675d9ba5e348938e473f5a6f96400980f (patch) | |
tree | 7de284185f9bc7845e322d5db98ec29036a1c11d /sys-utils | |
parent | dmesg: drop core at impossible case in read_buffer() [oclint] (diff) | |
download | kernel-qcow2-util-linux-eb2306e675d9ba5e348938e473f5a6f96400980f.tar.gz kernel-qcow2-util-linux-eb2306e675d9ba5e348938e473f5a6f96400980f.tar.xz kernel-qcow2-util-linux-eb2306e675d9ba5e348938e473f5a6f96400980f.zip |
misc: fix declarations shadowing variables in the global scope [oclint]
Fixes multiple occurences of 'optarg' overwrites.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/dmesg.c | 14 | ||||
-rw-r--r-- | sys-utils/ipcrm.c | 8 | ||||
-rw-r--r-- | sys-utils/lsipc.c | 6 | ||||
-rw-r--r-- | sys-utils/rtcwake.c | 6 |
4 files changed, 17 insertions, 17 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 92de6e26f..a2ab3a2e3 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -1178,19 +1178,19 @@ static int read_kmsg(struct dmesg_control *ctl) return 0; } -static int which_time_format(const char *optarg) +static int which_time_format(const char *s) { - if (!strcmp(optarg, "notime")) + if (!strcmp(s, "notime")) return DMESG_TIMEFTM_NONE; - if (!strcmp(optarg, "ctime")) + if (!strcmp(s, "ctime")) return DMESG_TIMEFTM_CTIME; - if (!strcmp(optarg, "delta")) + if (!strcmp(s, "delta")) return DMESG_TIMEFTM_DELTA; - if (!strcmp(optarg, "reltime")) + if (!strcmp(s, "reltime")) return DMESG_TIMEFTM_RELTIME; - if (!strcmp(optarg, "iso")) + if (!strcmp(s, "iso")) return DMESG_TIMEFTM_ISO8601; - errx(EXIT_FAILURE, _("unknown time format: %s"), optarg); + errx(EXIT_FAILURE, _("unknown time format: %s"), s); } #ifdef TEST_DMESG diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c index 7912feed9..06bbd446b 100644 --- a/sys-utils/ipcrm.c +++ b/sys-utils/ipcrm.c @@ -191,13 +191,13 @@ static unsigned long strtokey(const char *str, const char *errmesg) return 0; } -static int key_to_id(type_id type, char *optarg) +static int key_to_id(type_id type, char *s) { int id; /* keys are in hex or decimal */ - key_t key = strtokey(optarg, "failed to parse argument"); + key_t key = strtokey(s, "failed to parse argument"); if (key == IPC_PRIVATE) { - warnx(_("illegal key (%s)"), optarg); + warnx(_("illegal key (%s)"), s); return -1; } switch (type) { @@ -230,7 +230,7 @@ static int key_to_id(type_id type, char *optarg) default: err(EXIT_FAILURE, _("key failed")); } - warnx("%s (%s)", errmsg, optarg); + warnx("%s (%s)", errmsg, s); } return id; } diff --git a/sys-utils/lsipc.c b/sys-utils/lsipc.c index 9041dc17b..d4e5037ad 100644 --- a/sys-utils/lsipc.c +++ b/sys-utils/lsipc.c @@ -249,7 +249,7 @@ static char *get_groupname(struct group **gr, gid_t id) return *gr ? xstrdup((*gr)->gr_name) : NULL; } -static int parse_time_mode(const char *optarg) +static int parse_time_mode(const char *s) { struct lsipc_timefmt { const char *name; @@ -263,10 +263,10 @@ static int parse_time_mode(const char *optarg) size_t i; for (i = 0; i < ARRAY_SIZE(timefmts); i++) { - if (strcmp(timefmts[i].name, optarg) == 0) + if (strcmp(timefmts[i].name, s) == 0) return timefmts[i].val; } - errx(EXIT_FAILURE, _("unknown time format: %s"), optarg); + errx(EXIT_FAILURE, _("unknown time format: %s"), s); } static void __attribute__ ((__noreturn__)) usage(FILE * out) diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c index 053baf5ef..536c5bf5c 100644 --- a/sys-utils/rtcwake.c +++ b/sys-utils/rtcwake.c @@ -344,18 +344,18 @@ static int print_alarm(struct rtcwake_control *ctl, int fd) return 0; } -static int get_rtc_mode(struct rtcwake_control *ctl, const char *optarg) +static int get_rtc_mode(struct rtcwake_control *ctl, const char *s) { size_t i; char **modes = get_sys_power_states(ctl), **m; STRV_FOREACH(m, modes) { - if (strcmp(optarg, *m) == 0) + if (strcmp(s, *m) == 0) return SYSFS_MODE; } for (i = 0; i < ARRAY_SIZE(rtcwake_mode_string); i++) - if (!strcmp(optarg, rtcwake_mode_string[i])) + if (!strcmp(s, rtcwake_mode_string[i])) return i; return -EINVAL; |