Skip to contentSkip to conversation

demo: cross-link: Properly handle ioctl error

PATCH Superseded Michael Welling 2 participants 3 messages Feb 22, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 demo: cross-link: Properly handle ioctl error

Update cross-link demo to properly report ioctl errors.

---
 demo/alchemy/cobalt/cross-link.c | 2 ++
 1 file changed, 2 insertions(+)
demo/alchemy/cobalt/cross-link.c +2 -0
index 8c0f53f..f050524 100644
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <signal.h>
 #include <unistd.h>
+#include <errno.h>
 #include <sys/mman.h>
 #include <alchemy/task.h>
 #include <alchemy/timer.h>
@@ -199,6 +200,7 @@ static void read_task_proc(void *arg)
 		/* waiting for event */
 		err = ioctl(read_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event);
 		if (err) {
+			err = -errno;
 			printf(RTASK_PREFIX
 			       "error on RTSER_RTIOC_WAIT_EVENT, %s\n",
 			       strerror(-err));
Signature · 1 line
2.1.4
#1 lore raw
Quoted 1 line · Michael Welling

Update cross-link demo to properly report ioctl errors.

This fixes only one spot. Are there no other spots with the same issue?

Signature · 2 lines
					    Gilles.
https://click-hack.org
#2 lore raw
Quoted 4 lines · Gilles Chanteperdrix
Quoted 1 line · Michael Welling

Update cross-link demo to properly report ioctl errors.

This fixes only one spot. Are there no other spots with the same issue?

Oooops. Here come v2.

Quoted 4 lines
Signature · 3 lines
-- 
					    Gilles.
https://click-hack.org