]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
prlimit: don't care about xasprintf() return code
authorKarel Zak <kzak@redhat.com>
Wed, 12 Dec 2012 11:16:16 +0000 (12:16 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 12 Dec 2012 11:16:16 +0000 (12:16 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/prlimit.c

index 2055adf7536ae434670a2e6a01742a8460ae3440..a619bea3eec227a621c2153699a67c0b23b29185 100644 (file)
@@ -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);
        }
 }