summaryrefslogtreecommitdiffstats
path: root/sys-utils/lsipc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys-utils/lsipc.c')
-rw-r--r--sys-utils/lsipc.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/sys-utils/lsipc.c b/sys-utils/lsipc.c
index a851e67c1..5c7b2b6d5 100644
--- a/sys-utils/lsipc.c
+++ b/sys-utils/lsipc.c
@@ -649,6 +649,7 @@ static void do_sem(int id, struct lsipc_control *ctl, struct libscols_table *tb)
/* Create extra table with ID specific semaphore elements */
struct libscols_table *sub = new_table(ctl);
size_t i;
+ int rc = 0;
scols_table_enable_noheadings(sub, 0);
setup_sem_elements_columns(sub);
@@ -659,29 +660,44 @@ static void do_sem(int id, struct lsipc_control *ctl, struct libscols_table *tb)
/* SEMNUM */
xasprintf(&arg, "%zu", i);
- scols_line_refer_data(sln, 0, arg);
+ rc = scols_line_refer_data(sln, 0, arg);
+ if (rc)
+ break;
/* VALUE */
xasprintf(&arg, "%d", e->semval);
- scols_line_refer_data(sln, 1, arg);
+ rc = scols_line_refer_data(sln, 1, arg);
+ if (rc)
+ break;
/* NCOUNT */
xasprintf(&arg, "%d", e->ncount);
- scols_line_refer_data(sln, 2, arg);
+ rc = scols_line_refer_data(sln, 2, arg);
+ if (rc)
+ break;
/* ZCOUNT */
xasprintf(&arg, "%d", e->zcount);
- scols_line_refer_data(sln, 3, arg);
+ rc = scols_line_refer_data(sln, 3, arg);
+ if (rc)
+ break;
/* PID */
xasprintf(&arg, "%d", e->pid);
- scols_line_refer_data(sln, 4, arg);
+ rc = scols_line_refer_data(sln, 4, arg);
+ if (rc)
+ break;
/* COMMAND */
arg = proc_get_command(e->pid);
- scols_line_refer_data(sln, 5, arg);
+ rc = scols_line_refer_data(sln, 5, arg);
+ if (rc)
+ break;
}
+ if (rc != 0)
+ err(EXIT_FAILURE, _("failed to set data"));
+
scols_line_set_userdata(ln, (void *)sub);
break;
}