summaryrefslogtreecommitdiffstats
path: root/misc-utils/lslocks.c
diff options
context:
space:
mode:
authorKarel Zak2017-05-18 11:39:34 +0200
committerKarel Zak2017-05-18 11:39:34 +0200
commit780ce22cdad01128139c1edfceb8f86338bf3dda (patch)
treebca21a46c58d6bf60ecaf59a4fa669c5a487d688 /misc-utils/lslocks.c
parenttests: Fix UDF test output after changing UUID algorithm (diff)
downloadkernel-qcow2-util-linux-780ce22cdad01128139c1edfceb8f86338bf3dda.tar.gz
kernel-qcow2-util-linux-780ce22cdad01128139c1edfceb8f86338bf3dda.tar.xz
kernel-qcow2-util-linux-780ce22cdad01128139c1edfceb8f86338bf3dda.zip
misc: consolidate smartcols error messages
... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lslocks.c')
-rw-r--r--misc-utils/lslocks.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index 639db313f..7af554966 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -387,10 +387,8 @@ static void add_scols_line(struct libscols_table *table, struct lock *l, struct
assert(table);
line = scols_table_new_line(table, NULL);
- if (!line) {
- warn(_("failed to add line to output"));
- return;
- }
+ if (!line)
+ err(EXIT_FAILURE, _("failed to allocate output line"));
for (i = 0; i < ncolumns; i++) {
char *str = NULL;
@@ -434,8 +432,8 @@ static void add_scols_line(struct libscols_table *table, struct lock *l, struct
break;
}
- if (str)
- scols_line_set_data(line, i, str);
+ if (str && scols_line_set_data(line, i, str))
+ err(EXIT_FAILURE, _("failed to add output data"));
}
}
@@ -447,10 +445,9 @@ static int show_locks(struct list_head *locks)
struct libscols_table *table;
table = scols_new_table();
- if (!table) {
- warn(_("failed to initialize output table"));
- return -1;
- }
+ if (!table)
+ err(EXIT_FAILURE, _("failed to allocate output table"));
+
scols_table_enable_raw(table, raw);
scols_table_enable_json(table, json);
scols_table_enable_noheadings(table, no_headings);
@@ -461,11 +458,8 @@ static int show_locks(struct list_head *locks)
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"));
- rc = -1;
- goto done;
- }
+ if (!scols_table_new_column(table, col->name, col->whint, col->flags))
+ err(EXIT_FAILURE, _("failed to allocate output column"));
}
/* prepare data for output */