summaryrefslogtreecommitdiffstats
path: root/sys-utils/prlimit.c
diff options
context:
space:
mode:
authorKarel Zak2012-12-12 12:16:16 +0100
committerKarel Zak2012-12-12 12:16:16 +0100
commit76a9fcc91357c461735e3ff0159b55931d453d05 (patch)
treed33886d154bbe2342ea5915a950b2819b97581cd /sys-utils/prlimit.c
parentlscpu: don't care about xasprintf() return code (diff)
downloadkernel-qcow2-util-linux-76a9fcc91357c461735e3ff0159b55931d453d05.tar.gz
kernel-qcow2-util-linux-76a9fcc91357c461735e3ff0159b55931d453d05.tar.xz
kernel-qcow2-util-linux-76a9fcc91357c461735e3ff0159b55931d453d05.zip
prlimit: don't care about xasprintf() return code
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/prlimit.c')
-rw-r--r--sys-utils/prlimit.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index 2055adf75..a619bea3e 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -225,23 +225,24 @@ static void add_tt_line(struct tt *tt, struct prlimit *l)
for (i = 0; i < ncolumns; i++) {
char *str = NULL;
- int rc = 0;
switch (get_column_id(i)) {
case COL_RES:
- rc = xasprintf(&str, "%s", l->desc->name);
+ xasprintf(&str, "%s", l->desc->name);
break;
case COL_HELP:
- rc = xasprintf(&str, "%s", l->desc->help);
+ xasprintf(&str, "%s", l->desc->help);
break;
case COL_SOFT:
- rc = l->rlim.rlim_cur == RLIM_INFINITY ?
- xasprintf(&str, "%s", "unlimited") :
+ if (l->rlim.rlim_cur == RLIM_INFINITY)
+ xasprintf(&str, "%s", "unlimited");
+ else
xasprintf(&str, "%llu", (unsigned long long) l->rlim.rlim_cur);
break;
case COL_HARD:
- rc = l->rlim.rlim_max == RLIM_INFINITY ?
- xasprintf(&str, "%s", "unlimited") :
+ if (l->rlim.rlim_max == RLIM_INFINITY)
+ xasprintf(&str, "%s", "unlimited");
+ else
xasprintf(&str, "%llu", (unsigned long long) l->rlim.rlim_max);
break;
case COL_UNITS:
@@ -251,7 +252,7 @@ static void add_tt_line(struct tt *tt, struct prlimit *l)
break;
}
- if (rc || str)
+ if (str)
tt_line_set_data(line, i, str);
}
}