From 780ce22cdad01128139c1edfceb8f86338bf3dda Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 18 May 2017 11:39:34 +0200 Subject: misc: consolidate smartcols error messages ... just to keep translators happy Signed-off-by: Karel Zak --- sys-utils/losetup.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'sys-utils/losetup.c') diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c index 2218d3b43..8a9bdf55d 100644 --- a/sys-utils/losetup.c +++ b/sys-utils/losetup.c @@ -225,6 +225,7 @@ static int set_scols_data(struct loopdev_cxt *lc, struct libscols_line *ln) const char *p = NULL; /* external data */ char *np = NULL; /* allocated here */ uint64_t x = 0; + int rc; switch(get_column_id(i)) { case COL_NAME: @@ -285,9 +286,12 @@ static int set_scols_data(struct loopdev_cxt *lc, struct libscols_line *ln) if (p) - scols_line_set_data(ln, i, p); /* calls strdup() */ + rc = scols_line_set_data(ln, i, p); /* calls strdup() */ else if (np) - scols_line_refer_data(ln, i, np); /* only refers */ + rc = scols_line_refer_data(ln, i, np); /* only refers */ + + if (rc) + err(EXIT_FAILURE, _("failed to add output data")); } return 0; @@ -307,7 +311,7 @@ static int show_table(struct loopdev_cxt *lc, scols_init_debug(0); if (!(tb = scols_new_table())) - err(EXIT_FAILURE, _("failed to initialize output table")); + err(EXIT_FAILURE, _("failed to allocate output table")); scols_table_enable_raw(tb, raw); scols_table_enable_json(tb, json); scols_table_enable_noheadings(tb, no_headings); @@ -319,14 +323,14 @@ static int show_table(struct loopdev_cxt *lc, struct colinfo *ci = get_column_info(i); if (!scols_table_new_column(tb, ci->name, ci->whint, ci->flags)) - err(EXIT_FAILURE, _("failed to initialize output column")); + err(EXIT_FAILURE, _("failed to allocate output column")); } /* only one loopdev requested (already assigned to loopdev_cxt) */ if (loopcxt_get_device(lc)) { ln = scols_table_new_line(tb, NULL); if (!ln) - err(EXIT_FAILURE, _("failed to initialize output line")); + err(EXIT_FAILURE, _("failed to allocate output line")); rc = set_scols_data(lc, ln); /* list all loopdevs */ @@ -355,7 +359,7 @@ static int show_table(struct loopdev_cxt *lc, ln = scols_table_new_line(tb, NULL); if (!ln) - err(EXIT_FAILURE, _("failed to initialize output column")); + err(EXIT_FAILURE, _("failed to allocate output line")); rc = set_scols_data(lc, ln); if (rc) break; -- cgit v1.2.3-55-g7522