git » libfiu » commit dfa9363

Print the cause of error

author Yan Burman
2020-03-05 06:54:57 UTC
committer Alberto Bertogli
2020-03-06 10:02:40 UTC
parent 2e192afe7752b4d10582f816489f23c487043791

Print the cause of error

Signed-off-by: Yan Burman <yanburman@users.noreply.github.com>

libfiu/fiu-rc.c +3 -1

diff --git a/libfiu/fiu-rc.c b/libfiu/fiu-rc.c
index 3db2cfc..71e682e 100644
--- a/libfiu/fiu-rc.c
+++ b/libfiu/fiu-rc.c
@@ -197,13 +197,15 @@ static int rc_do_command(int fdr, int fdw)
 {
 	int len, r, reply_len;
 	char buf[MAX_LINE], reply[MAX_LINE];
-	char *error;
+	char *error = NULL;
 
 	len = read_line(fdr, buf);
 	if (len <= 0)
 		return len;
 
 	r = fiu_rc_string(buf, &error);
+	if (r < 0)
+		fprintf(stderr, "fiu_rc_string error: %s\n", error);
 
 	reply_len = snprintf(reply, MAX_LINE, "%d\n", r);
 	r = write(fdw, reply, reply_len);