From 8a1d24a704853bbb211aec62905191dac8411074 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Mon, 7 Dec 2020 08:16:18 -0800 Subject: [PATCH] rproc: Make state update errors more helpful Include the reason for the failure to update the "state" sysfs attribtue in the error message. Signed-off-by: Bjorn Andersson --- rproc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rproc.c b/rproc.c index d104490..3f17a74 100644 --- a/rproc.c +++ b/rproc.c @@ -176,8 +176,10 @@ static void *do_rproc_start(void *unused) ssize_t ret; ret = pwrite(rproc_state_fd, "start", 5, 0); - if (ret < 4) - fprintf(stderr, "failed to update start state\n"); + if (ret < 4) { + fprintf(stderr, "failed to update start state: %s\n", + strerror(errno)); + } return NULL; } @@ -192,8 +194,10 @@ static void *do_rproc_stop(void *unused) ssize_t ret; ret = pwrite(rproc_state_fd, "stop", 4, 0); - if (ret < 4) - fprintf(stderr, "failed to update stop state\n"); + if (ret < 4) { + fprintf(stderr, "failed to update stop state: %s\n", + strerror(errno)); + } ret = write(rproc_pipe[1], "Y", 1); if (ret != 1) {