]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: consolidate smartcols error messages
authorKarel Zak <kzak@redhat.com>
Thu, 18 May 2017 09:39:34 +0000 (11:39 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 18 May 2017 09:39:34 +0000 (11:39 +0200)
... just to keep translators happy

Signed-off-by: Karel Zak <kzak@redhat.com>
14 files changed:
disk-utils/fdisk-list.c
disk-utils/partx.c
login-utils/lslogins.c
misc-utils/fincore.c
misc-utils/findmnt.c
misc-utils/lsblk.c
misc-utils/lslocks.c
sys-utils/losetup.c
sys-utils/lscpu.c
sys-utils/lsipc.c
sys-utils/prlimit.c
sys-utils/swapon.c
sys-utils/wdctl.c
sys-utils/zramctl.c

index dd209435d69c2c86cf9632c7b8b95c917ca6f288..0985bd51fb44a09424479e74ec684378c640367b 100644 (file)
@@ -169,8 +169,10 @@ void list_disklabel(struct fdisk_context *cxt)
 
                        if (fdisk_partition_to_string(pa, cxt, ids[i], &data))
                                continue;
-                       if (scols_line_refer_data(ln, i, data))
-                               fdisk_warn(cxt, _("failed to refer output data"));
+                       if (scols_line_refer_data(ln, i, data)) {
+                               fdisk_warn(cxt, _("failed to add output data"));
+                               goto done;
+                       }
                }
        }
 
@@ -267,7 +269,10 @@ void list_freespace(struct fdisk_context *cxt)
                for (i = 0; i < ARRAY_SIZE(colids); i++) {
                        if (fdisk_partition_to_string(pa, cxt, colids[i], &data))
                                continue;
-                       scols_line_refer_data(ln, i, data);
+                       if (scols_line_refer_data(ln, i, data)) {
+                               fdisk_warn(cxt, _("failed to add output data"));
+                               goto done;
+                       }
                }
 
                if (fdisk_partition_has_size(pa))
index cc00b24bc31f8cb96e7431de9076f376e7b97013..941fc46aaf333b0507ce3ec1f84eec9ed621cfb2 100644 (file)
@@ -578,7 +578,7 @@ static int add_scols_line(struct libscols_table *table, blkid_partition par)
 
        line = scols_table_new_line(table, NULL);
        if (!line) {
-               warn(_("failed to add line to output"));
+               warn(_("failed to allocate output line"));
                return -ENOMEM;
        }
 
@@ -641,7 +641,7 @@ static int add_scols_line(struct libscols_table *table, blkid_partition par)
                else if (str)
                        rc = scols_line_refer_data(line, i, str);
                if (rc) {
-                       warn(_("failed to add data to output table"));
+                       warn(_("failed to add output data"));
                        break;
                }
        }
@@ -664,7 +664,7 @@ static int show_parts(blkid_partlist ls, int scols_flags, int lower, int upper)
        scols_init_debug(0);
        table = scols_new_table();
        if (!table) {
-               warn(_("failed to initialize output table"));
+               warn(_("failed to allocate output table"));
                return -1;
        }
        scols_table_enable_raw(table, !!(scols_flags & PARTX_RAW));
@@ -675,7 +675,7 @@ static int show_parts(blkid_partlist ls, int scols_flags, int lower, int upper)
                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"));
+                       warnx(_("failed to allocate output column"));
                        goto done;
                }
        }
index f7acac9b9da5282e9e07bcef9bc0a0ffa95fe46a..ab04c10bb2214f738feed77219ce4ae6deec4e70 100644 (file)
@@ -915,7 +915,7 @@ static struct libscols_table *setup_table(struct lslogins_control *ctl)
        int n = 0;
 
        if (!table)
-               errx(EXIT_FAILURE, _("failed to initialize output table"));
+               err(EXIT_FAILURE, _("failed to allocate output table"));
        if (ctl->noheadings)
                scols_table_enable_noheadings(table, 1);
 
@@ -972,6 +972,9 @@ static void fill_table(const void *u, const VISIT which, const int depth __attri
                return;
 
        ln = scols_table_new_line(tb, NULL);
+       if (!ln)
+               err(EXIT_FAILURE, _("failed to allocate output line"));
+
        while (n < ncolumns) {
                int rc = 0;
 
@@ -1067,8 +1070,8 @@ static void fill_table(const void *u, const VISIT which, const int depth __attri
                        err(EXIT_FAILURE, _("internal error: unknown column"));
                }
 
-               if (rc != 0)
-                       err(EXIT_FAILURE, _("failed to set data"));
+               if (rc)
+                       err(EXIT_FAILURE, _("failed to add output data"));
                ++n;
        }
        return;
index 28103ad5d156777caca950fa5fd84cb22ed2fb95..30d5dd1bc639eb35004f591907a44e1692829347 100644 (file)
@@ -120,7 +120,7 @@ static int add_output_data(struct fincore_control *ctl,
 
        ln = scols_table_new_line(ctl->tb, NULL);
        if (!ln)
-               err(EXIT_FAILURE, _("failed to initialize output line"));
+               err(EXIT_FAILURE, _("failed to allocate output line"));
 
        for (i = 0; i < ncolumns; i++) {
                int rc = 0;
@@ -359,7 +359,7 @@ int main(int argc, char ** argv)
        scols_init_debug(0);
        ctl.tb = scols_new_table();
        if (!ctl.tb)
-               err(EXIT_FAILURE, _("failed to create output table"));
+               err(EXIT_FAILURE, _("failed to allocate output table"));
 
        scols_table_enable_noheadings(ctl.tb, ctl.noheadings);
        scols_table_enable_raw(ctl.tb, ctl.raw);
@@ -371,7 +371,7 @@ int main(int argc, char ** argv)
                const struct colinfo *col = get_column_info(i);
 
                if (!scols_table_new_column(ctl.tb, col->name, col->whint, col->flags))
-                       err(EXIT_FAILURE, _("failed to initialize output column"));
+                       err(EXIT_FAILURE, _("failed to allocate output column"));
        }
 
        for(; optind < argc; optind++) {
index d83dca92c306faa93d49f050ec4f921af2e329cb..86b6b9aa1d00d08c349e17db1f1e59348e0accec 100644 (file)
@@ -684,12 +684,13 @@ static struct libscols_line *add_line(struct libscols_table *table, struct libmn
        size_t i;
        struct libscols_line *line = scols_table_new_line(table, parent);
 
-       if (!line) {
-               warn(_("failed to add line to output"));
-               return NULL;
+       if (!line)
+               err(EXIT_FAILURE, _("failed to allocate output line"));
+
+       for (i = 0; i < ncolumns; i++) {
+               if (scols_line_refer_data(line, i, get_data(fs, i)))
+                       err(EXIT_FAILURE, _("failed to add output data"));
        }
-       for (i = 0; i < ncolumns; i++)
-               scols_line_refer_data(line, i, get_data(fs, i));
 
        scols_line_set_userdata(line, fs);
        return line;
@@ -701,13 +702,14 @@ static struct libscols_line *add_tabdiff_line(struct libscols_table *table, stru
        size_t i;
        struct libscols_line *line = scols_table_new_line(table, NULL);
 
-       if (!line) {
-               warn(_("failed to add line to output"));
-               return NULL;
+       if (!line)
+               err(EXIT_FAILURE, _("failed to allocate output line"));
+
+       for (i = 0; i < ncolumns; i++) {
+               if (scols_line_refer_data(line, i,
+                               get_tabdiff_data(old_fs, new_fs, change, i)))
+                       err(EXIT_FAILURE, _("failed to add output data"));
        }
-       for (i = 0; i < ncolumns; i++)
-               scols_line_refer_data(line, i,
-                               get_tabdiff_data(old_fs, new_fs, change, i));
 
        return line;
 }
@@ -1593,7 +1595,7 @@ int main(int argc, char *argv[])
        scols_init_debug(0);
        table = scols_new_table();
        if (!table) {
-               warn(_("failed to initialize output table"));
+               warn(_("failed to allocate output table"));
                goto leave;
        }
        scols_table_enable_raw(table,        !!(flags & FL_RAW));
@@ -1619,7 +1621,7 @@ int main(int argc, char *argv[])
                }
                if (!scols_table_new_column(table, get_column_name(i),
                                        get_column_whint(i), fl)) {
-                       warn(_("failed to initialize output column"));
+                       warn(_("failed to allocate output column"));
                        goto leave;
                }
        }
index e778642db090422bc8b8bbf8bf51d0a41f124f6b..79077af07bc50ffef8e04ad83b11484d0208ae46 100644 (file)
@@ -1161,8 +1161,8 @@ static void set_scols_data(struct blkdev_cxt *cxt, int col, int id, struct libsc
                break;
        };
 
-       if (str)
-               scols_line_refer_data(ln, col, str);
+       if (str && scols_line_refer_data(ln, col, str))
+               err(EXIT_FAILURE, _("failed to add output data"));
 }
 
 static void fill_table_line(struct blkdev_cxt *cxt, struct libscols_line *scols_parent)
@@ -1171,7 +1171,7 @@ static void fill_table_line(struct blkdev_cxt *cxt, struct libscols_line *scols_
 
        cxt->scols_line = scols_table_new_line(lsblk->table, scols_parent);
        if (!cxt->scols_line)
-               return;
+               err(EXIT_FAILURE, _("failed to allocate output line"));
 
        for (i = 0; i < ncolumns; i++)
                set_scols_data(cxt, i, get_column_id(i), cxt->scols_line);
@@ -1894,7 +1894,7 @@ int main(int argc, char *argv[])
         * initialize output columns
         */
        if (!(lsblk->table = scols_new_table()))
-               errx(EXIT_FAILURE, _("failed to initialize output table"));
+               errx(EXIT_FAILURE, _("failed to allocate output table"));
        scols_table_enable_raw(lsblk->table, !!(lsblk->flags & LSBLK_RAW));
        scols_table_enable_export(lsblk->table, !!(lsblk->flags & LSBLK_EXPORT));
        scols_table_enable_ascii(lsblk->table, !!(lsblk->flags & LSBLK_ASCII));
@@ -1916,7 +1916,7 @@ int main(int argc, char *argv[])
 
                cl = scols_table_new_column(lsblk->table, ci->name, ci->whint, fl);
                if (!cl) {
-                       warn(_("failed to initialize output column"));
+                       warn(_("failed to allocate output column"));
                        goto leave;
                }
                if (!lsblk->sort_col && lsblk->sort_id == id) {
index 639db313fb2366398e82435a78bbdc1407b37564..7af55496633caabc4e900cc305301f8025cdd06b 100644 (file)
@@ -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 */
index 2218d3b437251888ca1c1139c3ce39b81bdb696f..8a9bdf55d3da9601985bdc4d6147cd2748a3caa1 100644 (file)
@@ -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;
index 8baa3cc26fa88e9493a83dd5375ab2433674c427..dc998267a83e70449a2f744927e42d55b49c303e 100644 (file)
@@ -1757,7 +1757,7 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
 
        table = scols_new_table();
        if (!table)
-                err(EXIT_FAILURE, _("failed to initialize output table"));
+                err(EXIT_FAILURE, _("failed to allocate output table"));
        if (mod->json) {
                scols_table_enable_json(table, 1);
                scols_table_set_name(table, "cpus");
@@ -1766,7 +1766,7 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
        for (i = 0; i < ncols; i++) {
                data = get_cell_header(desc, cols[i], mod, buf, sizeof(buf));
                if (!scols_table_new_column(table, data, 0, 0))
-                       err(EXIT_FAILURE, _("failed to initialize output column"));
+                       err(EXIT_FAILURE, _("failed to allocate output column"));
        }
 
        for (i = 0; i < desc->ncpuspos; i++) {
@@ -1783,7 +1783,7 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
 
                line = scols_table_new_line(table, NULL);
                if (!line)
-                       err(EXIT_FAILURE, _("failed to initialize output line"));
+                       err(EXIT_FAILURE, _("failed to allocate output line"));
 
                for (c = 0; c < ncols; c++) {
                        data = get_cell_data(desc, i, cols[c], mod,
@@ -1791,7 +1791,7 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
                        if (!data || !*data)
                                data = "-";
                        if (scols_line_set_data(line, c, data))
-                               err_oom();
+                               err(EXIT_FAILURE, _("failed to add output data"));
                }
        }
 
@@ -1811,7 +1811,7 @@ static void __attribute__ ((__format__(printf, 3, 4)))
        va_list args;
 
        if (!ln)
-               err(EXIT_FAILURE, _("failed to initialize output line"));
+               err(EXIT_FAILURE, _("failed to allocate output line"));
 
        /* description column */
        scols_line_set_data(ln, 0, txt);
@@ -1821,8 +1821,8 @@ static void __attribute__ ((__format__(printf, 3, 4)))
        xvasprintf(&data, fmt, args);
        va_end(args);
 
-       if (data)
-               scols_line_refer_data(ln, 1, data);
+       if (data && scols_line_refer_data(ln, 1, data))
+                err(EXIT_FAILURE, _("failed to add output data"));
 }
 
 #define add_summary_n(tb, txt, num)    add_summary_sprint(tb, txt, "%d", num)
@@ -1860,7 +1860,7 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 
        tb = scols_new_table();
        if (!tb)
-                err(EXIT_FAILURE, _("failed to initialize output table"));
+               err(EXIT_FAILURE, _("failed to allocate output table"));
 
        scols_table_enable_noheadings(tb, 1);
        if (mod->json) {
index 239aaf5d78438c0451c803798060b97df8e5760a..3e7586b32e0291602cfbaaea69365769d9386ae9 100644 (file)
@@ -335,7 +335,8 @@ static struct libscols_table *new_table(struct lsipc_control *ctl)
        struct libscols_table *table = scols_new_table();
 
        if (!table)
-               errx(EXIT_FAILURE, _("failed to initialize output table"));
+               err(EXIT_FAILURE, _("failed to allocate output table"));
+
        if (ctl->noheadings)
                scols_table_enable_noheadings(table, 1);
 
@@ -466,7 +467,7 @@ static void global_set_data(struct libscols_table *tb, const char *resource,
 
        ln = scols_table_new_line(tb, NULL);
        if (!ln)
-               err_oom();
+               err(EXIT_FAILURE, _("failed to allocate output line"));
 
        for (n = 0; n < ncolumns; n++) {
                int rc = 0;
@@ -500,7 +501,7 @@ static void global_set_data(struct libscols_table *tb, const char *resource,
                }
 
                if (rc != 0)
-                       err(EXIT_FAILURE, _("failed to set data"));
+                       err(EXIT_FAILURE, _("failed to add output data"));
        }
 }
 
@@ -538,7 +539,10 @@ static void do_sem(int id, struct lsipc_control *ctl, struct libscols_table *tb)
        }
        for (semdsp = semds;  semdsp->next != NULL || id > -1; semdsp = semdsp->next) {
                size_t n;
+
                ln = scols_table_new_line(tb, NULL);
+               if (!ln)
+                       err(EXIT_FAILURE, _("failed to allocate output line"));
 
                for (n = 0; n < ncolumns; n++) {
                        int rc = 0;
@@ -622,7 +626,7 @@ static void do_sem(int id, struct lsipc_control *ctl, struct libscols_table *tb)
                                break;
                        }
                        if (rc != 0)
-                               err(EXIT_FAILURE, _("failed to set data"));
+                               err(EXIT_FAILURE, _("failed to add output data"));
                        arg = NULL;
                }
 
@@ -639,6 +643,9 @@ static void do_sem(int id, struct lsipc_control *ctl, struct libscols_table *tb)
                                struct sem_elem *e = &semds->elements[i];
                                struct libscols_line *sln = scols_table_new_line(sub, NULL);
 
+                               if (!sln)
+                                       err(EXIT_FAILURE, _("failed to allocate output line"));
+
                                /* SEMNUM */
                                xasprintf(&arg, "%zu", i);
                                rc = scols_line_refer_data(sln, 0, arg);
@@ -728,6 +735,9 @@ static void do_msg(int id, struct lsipc_control *ctl, struct libscols_table *tb)
                size_t n;
                ln = scols_table_new_line(tb, NULL);
 
+               if (!ln)
+                       err(EXIT_FAILURE, _("failed to allocate output line"));
+
                /* no need to call getpwuid() for the same user */
                if (!(pw && pw->pw_uid == msgdsp->msg_perm.uid))
                        pw = getpwuid(msgdsp->msg_perm.uid);
@@ -885,8 +895,9 @@ static void do_shm(int id, struct lsipc_control *ctl, struct libscols_table *tb)
        for (shmdsp = shmds; shmdsp->next != NULL || id > -1 ; shmdsp = shmdsp->next) {
                size_t n;
                ln = scols_table_new_line(tb, NULL);
+
                if (!ln)
-                       err_oom();
+                       err(EXIT_FAILURE, _("failed to allocate output line"));
 
                for (n = 0; n < ncolumns; n++) {
                        int rc = 0;
index c96d38589ebf9c3fe3bbad2f3b4ff23104c4272a..a62d457feb8875ca6ff2f0d31d89c6a5ca0baaaa 100644 (file)
@@ -226,7 +226,7 @@ static void add_scols_line(struct libscols_table *table, struct prlimit *l)
 
        line = scols_table_new_line(table, NULL);
        if (!line)
-               err(EXIT_FAILURE, _("failed to initialize output line"));
+               err(EXIT_FAILURE, _("failed to allocate output line"));
 
        for (i = 0; i < ncolumns; i++) {
                char *str = NULL;
@@ -257,8 +257,8 @@ static void add_scols_line(struct libscols_table *table, struct prlimit *l)
                        break;
                }
 
-               if (str)
-                       scols_line_refer_data(line, i, str);
+               if (str && scols_line_refer_data(line, i, str))
+                       err(EXIT_FAILURE, _("failed to add output data"));
        }
 }
 
@@ -294,7 +294,7 @@ static int show_limits(struct list_head *lims)
 
        table = scols_new_table();
        if (!table)
-               err(EXIT_FAILURE, _("failed to initialize output table"));
+               err(EXIT_FAILURE, _("failed to allocate output table"));
 
        scols_table_enable_raw(table, raw);
        scols_table_enable_noheadings(table, no_headings);
@@ -303,10 +303,9 @@ static int show_limits(struct list_head *lims)
                struct colinfo *col = get_column_info(i);
 
                if (!scols_table_new_column(table, col->name, col->whint, col->flags))
-                       err(EXIT_FAILURE, _("failed to initialize output column"));
+                       err(EXIT_FAILURE, _("failed to allocate output column"));
        }
 
-
        list_for_each_safe(p, pnext, lims) {
                struct prlimit *lim = list_entry(p, struct prlimit, lims);
 
index f6005e67d48f22e3f99bf423c7feade52db91068..f4ca781d8da46fbc7c33691df4775763d5c61162 100644 (file)
@@ -173,7 +173,8 @@ static void add_scols_line(const struct swapon_ctl *ctl, struct libscols_table *
 
        line = scols_table_new_line(table, NULL);
        if (!line)
-               err(EXIT_FAILURE, _("failed to initialize output line"));
+               err(EXIT_FAILURE, _("failed to allocate output line"));
+
        data = mnt_fs_get_source(fs);
        if (access(data, R_OK) == 0)
                pr = get_swap_prober(data);
@@ -219,8 +220,8 @@ static void add_scols_line(const struct swapon_ctl *ctl, struct libscols_table *
                        break;
                }
 
-               if (str)
-                       scols_line_refer_data(line, i, str);
+               if (str && scols_line_refer_data(line, i, str))
+                       err(EXIT_FAILURE, _("failed to add output data"));
        }
        if (pr)
                blkid_free_probe(pr);
@@ -277,7 +278,7 @@ static int show_table(struct swapon_ctl *ctl)
 
        table = scols_new_table();
        if (!table)
-               err(EXIT_FAILURE, _("failed to initialize output table"));
+               err(EXIT_FAILURE, _("failed to allocate output table"));
 
        scols_table_enable_raw(table, ctl->raw);
        scols_table_enable_noheadings(table, ctl->no_heading);
@@ -286,7 +287,7 @@ static int show_table(struct swapon_ctl *ctl)
                struct colinfo *col = get_column_info(ctl, i);
 
                if (!scols_table_new_column(table, col->name, col->whint, col->flags))
-                       err(EXIT_FAILURE, _("failed to initialize output column"));
+                       err(EXIT_FAILURE, _("failed to allocate output column"));
        }
 
        while (mnt_table_next_fs(st, itr, &fs) == 0)
index 441b7abf9872d83ed38ea8fab9f9ae8e2b6672f1..e47fc70e989404260dbd68b112c52b8dcf582831 100644 (file)
@@ -212,7 +212,7 @@ static void add_flag_line(struct libscols_table *table, struct wdinfo *wd, const
 
        line = scols_table_new_line(table, NULL);
        if (!line) {
-               warn(_("failed to initialize output line"));
+               warn(_("failed to allocate output line"));
                return;
        }
 
@@ -239,8 +239,10 @@ static void add_flag_line(struct libscols_table *table, struct wdinfo *wd, const
                        break;
                }
 
-               if (str)
-                       scols_line_set_data(line, i, str);
+               if (str && scols_line_set_data(line, i, str)) {
+                       warn(_("failed to add output data"));
+                       break;
+               }
        }
 }
 
@@ -256,7 +258,7 @@ static int show_flags(struct wdinfo *wd, uint32_t wanted)
        /* create output table */
        table = scols_new_table();
        if (!table) {
-               warn(_("failed to initialize output table"));
+               warn(_("failed to allocate output table"));
                return -1;
        }
        scols_table_enable_raw(table, raw);
@@ -267,7 +269,7 @@ static int show_flags(struct wdinfo *wd, uint32_t wanted)
                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"));
+                       warnx(_("failed to allocate output column"));
                        goto done;
                }
        }
index b5fc08edf2e5eefa5a350294d538abf016be2a18..4ae4742dd200d579df8b871299a98dbe75ad7f43 100644 (file)
@@ -406,7 +406,7 @@ static void fill_table_row(struct libscols_table *tb, struct zram *z)
 
        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"));
 
        for (i = 0; i < (size_t) ncolumns; i++) {
                char *str = NULL;
@@ -471,8 +471,8 @@ static void fill_table_row(struct libscols_table *tb, struct zram *z)
                        str = get_mm_stat(z, MM_NUM_MIGRATED, inbytes);
                        break;
                }
-               if (str)
-                       scols_line_refer_data(ln, i, str);
+               if (str && scols_line_refer_data(ln, i, str))
+                       err(EXIT_FAILURE, _("failed to add output data"))
        }
 }
 
@@ -485,7 +485,7 @@ static void status(struct zram *z)
 
        tb = scols_new_table();
        if (!tb)
-               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_noheadings(tb, no_headings);