summaryrefslogtreecommitdiffstats
path: root/sys-utils/prlimit.c
diff options
context:
space:
mode:
authorKarel Zak2014-04-03 10:53:03 +0200
committerKarel Zak2014-04-03 12:29:20 +0200
commit05186e79ffd8a1b3368065e18ed0ed77badc5c09 (patch)
tree5d751731b8277a77d7d5dcf2b8f0baded9f57344 /sys-utils/prlimit.c
parentlscpu: clean up scols usage (diff)
downloadkernel-qcow2-util-linux-05186e79ffd8a1b3368065e18ed0ed77badc5c09.tar.gz
kernel-qcow2-util-linux-05186e79ffd8a1b3368065e18ed0ed77badc5c09.tar.xz
kernel-qcow2-util-linux-05186e79ffd8a1b3368065e18ed0ed77badc5c09.zip
prlimit: clean up scols usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/prlimit.c')
-rw-r--r--sys-utils/prlimit.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index 4e0cc5eda..9b1b85f65 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -221,10 +221,8 @@ static void add_scols_line(struct libscols_table *table, struct prlimit *l)
assert(l);
line = scols_table_new_line(table, NULL);
- if (!line) {
- warn(_("failed to add line to output"));
- return;
- }
+ if (!line)
+ err(EXIT_FAILURE, _("failed to initialize output line"));
for (i = 0; i < ncolumns; i++) {
char *str = NULL;
@@ -256,7 +254,7 @@ static void add_scols_line(struct libscols_table *table, struct prlimit *l)
}
if (str)
- scols_line_set_data(line, i, str);
+ scols_line_refer_data(line, i, str);
}
}
@@ -291,20 +289,17 @@ static int show_limits(struct list_head *lims)
struct libscols_table *table;
table = scols_new_table(NULL);
- if (!table) {
- warn(_("failed to initialize output table"));
- return -1;
- }
+ if (!table)
+ err(EXIT_FAILURE, _("failed to initialize output table"));
+
scols_table_set_raw(table, raw);
scols_table_set_no_headings(table, no_headings);
for (i = 0; i < ncolumns; i++) {
struct colinfo *col = get_column_info(i);
- if (!scols_table_new_column(table, col->name, col->whint, col->flags)) {
- warnx(_("failed to initialize output column"));
- goto done;
- }
+ if (!scols_table_new_column(table, col->name, col->whint, col->flags))
+ err(EXIT_FAILURE, _("failed to initialize output column"));
}
@@ -316,7 +311,6 @@ static int show_limits(struct list_head *lims)
}
scols_print_table(table);
-done:
scols_unref_table(table);
return 0;
}