@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
-
+#include <errno.h>
#include <string.h>
#define xstreq(x, y) !strcmp(x, y)
@@ -631,7 +631,10 @@ static void disp_con(const char *scon_raw)
char *color_str = NULL;
struct context_color_t color = { .valid = 0 };
- selinux_raw_to_trans_context(scon_raw, &scon_trans);
+ if (selinux_raw_to_trans_context(scon_raw, &scon_trans) < 0)
+ errx(EXIT_FAILURE, "Couldn't convert context %s: %s",
+ scon_raw, strerror(errno));
+
if (opts->disp_raw)
scon = scon_raw;
else
secon.c: In function ‘disp_con’: secon.c:634:9: error: ignoring return value of ‘selinux_raw_to_trans_context’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] 634 | selinux_raw_to_trans_context(scon_raw, &scon_trans); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- policycoreutils/secon/secon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)