summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorSami Kerola2016-07-04 23:09:10 +0200
committerSami Kerola2016-07-21 22:14:33 +0200
commit74ce680a3ef90503b26da0a34f04cf725f6c5beb (patch)
tree307baa695e1c36c7a7855718468d9913ddf96bc1 /sys-utils
parentagetty: call uname() only when necessary (diff)
downloadkernel-qcow2-util-linux-74ce680a3ef90503b26da0a34f04cf725f6c5beb.tar.gz
kernel-qcow2-util-linux-74ce680a3ef90503b26da0a34f04cf725f6c5beb.tar.xz
kernel-qcow2-util-linux-74ce680a3ef90503b26da0a34f04cf725f6c5beb.zip
misc: simplify if clauses [oclint]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/dmesg.c13
-rw-r--r--sys-utils/ipcrm.c5
-rw-r--r--sys-utils/rtcwake.c9
-rw-r--r--sys-utils/setpriv.c10
-rw-r--r--sys-utils/setsid.c6
5 files changed, 16 insertions, 27 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 36c966f6a..454438842 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -1116,8 +1116,6 @@ static int parse_kmsg_record(struct dmesg_control *ctl,
/* D) optional fields (ignore) */
p = skip_item(p, end, ";");
- if (LAST_KMSG_FIELD(p))
- goto mesg;
mesg:
/* E) message text */
@@ -1391,12 +1389,11 @@ int main(int argc, char *argv[])
if (argc > 1)
usage(stderr);
- if (is_timefmt(&ctl, RELTIME) ||
- is_timefmt(&ctl, CTIME) ||
- is_timefmt(&ctl, ISO8601)) {
- if (dmesg_get_boot_time(&ctl.boot_time) != 0)
- ctl.time_fmt = DMESG_TIMEFTM_NONE;
- }
+ if ((is_timefmt(&ctl, RELTIME) ||
+ is_timefmt(&ctl, CTIME) ||
+ is_timefmt(&ctl, ISO8601))
+ && dmesg_get_boot_time(&ctl.boot_time) != 0)
+ ctl.time_fmt = DMESG_TIMEFTM_NONE;
if (delta)
switch (ctl.time_fmt) {
diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c
index 0b40f1539..7912feed9 100644
--- a/sys-utils/ipcrm.c
+++ b/sys-utils/ipcrm.c
@@ -407,9 +407,8 @@ int main(int argc, char **argv)
}
}
- if (rm_all)
- if (remove_all(what_all))
- ret++;
+ if (rm_all && remove_all(what_all))
+ ret++;
/* print usage if we still have some arguments left over */
if (optind < argc) {
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 72894eab8..053baf5ef 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -501,12 +501,9 @@ int main(int argc, char **argv)
}
}
- if (ctl.clock_mode == CM_AUTO) {
- if (read_clock_mode(&ctl) < 0) {
- printf(_("%s: assuming RTC uses UTC ...\n"),
- program_invocation_short_name);
- ctl.clock_mode = CM_UTC;
- }
+ if (ctl.clock_mode == CM_AUTO && read_clock_mode(&ctl) < 0) {
+ printf(_("%s: assuming RTC uses UTC ...\n"), program_invocation_short_name);
+ ctl.clock_mode = CM_UTC;
}
if (ctl.verbose)
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 163012223..3b99a177e 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -781,9 +781,8 @@ int main(int argc, char **argv)
errx(EXIT_FAILURE,
_("--[re]gid requires --keep-groups, --clear-groups, or --groups"));
- if (opts.nnp)
- if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
- err(EXIT_FAILURE, _("disallow granting new privileges failed"));
+ if (opts.nnp && prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
+ err(EXIT_FAILURE, _("disallow granting new privileges failed"));
if (opts.selinux_label)
do_selinux_label(opts.selinux_label);
@@ -820,9 +819,8 @@ int main(int argc, char **argv)
err(SETPRIV_EXIT_PRIVERR, _("setgroups failed"));
}
- if (opts.have_securebits)
- if (prctl(PR_SET_SECUREBITS, opts.securebits, 0, 0, 0) != 0)
- err(SETPRIV_EXIT_PRIVERR, _("set process securebits failed"));
+ if (opts.have_securebits && prctl(PR_SET_SECUREBITS, opts.securebits, 0, 0, 0) != 0)
+ err(SETPRIV_EXIT_PRIVERR, _("set process securebits failed"));
if (opts.bounding_set) {
do_caps(CAPNG_BOUNDING_SET, opts.bounding_set);
diff --git a/sys-utils/setsid.c b/sys-utils/setsid.c
index bb089df21..bae97ff9b 100644
--- a/sys-utils/setsid.c
+++ b/sys-utils/setsid.c
@@ -109,10 +109,8 @@ int main(int argc, char **argv)
/* cannot happen */
err(EXIT_FAILURE, _("setsid failed"));
- if (ctty) {
- if (ioctl(STDIN_FILENO, TIOCSCTTY, 1))
- err(EXIT_FAILURE, _("failed to set the controlling terminal"));
- }
+ if (ctty && ioctl(STDIN_FILENO, TIOCSCTTY, 1))
+ err(EXIT_FAILURE, _("failed to set the controlling terminal"));
execvp(argv[optind], argv + optind);
err(EXIT_FAILURE, _("failed to execute %s"), argv[optind]);
}