[PATCH evemu 1/5] tools: append strerror to the error messages
Peter Hutterer
peter.hutterer at who-t.net
Thu Feb 25 00:41:50 UTC 2016
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
tools/evemu-device.c | 2 +-
tools/evemu-event.c | 2 +-
tools/evemu-play.c | 2 +-
tools/evemu-record.c | 8 ++++----
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/evemu-device.c b/tools/evemu-device.c
index 66047f2..925e5d5 100644
--- a/tools/evemu-device.c
+++ b/tools/evemu-device.c
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
}
fp = fopen(argv[1], "r");
if (!fp) {
- fprintf(stderr, "error: could not open file\n");
+ fprintf(stderr, "error: could not open file (%m)\n");
return -1;
}
ret = evemu_device(fp);
diff --git a/tools/evemu-event.c b/tools/evemu-event.c
index 0ee4c8e..ce928ac 100644
--- a/tools/evemu-event.c
+++ b/tools/evemu-event.c
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
fd = open(path, O_WRONLY);
if (fd < 0) {
- fprintf(stderr, "error: could not open device\n");
+ fprintf(stderr, "error: could not open device (%m)\n");
goto out;
}
diff --git a/tools/evemu-play.c b/tools/evemu-play.c
index d819567..84aa668 100644
--- a/tools/evemu-play.c
+++ b/tools/evemu-play.c
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
}
fd = open(argv[1], O_WRONLY);
if (fd < 0) {
- fprintf(stderr, "error: could not open device\n");
+ fprintf(stderr, "error: could not open device (%m)\n");
return -1;
}
if (evemu_play(stdin, fd)) {
diff --git a/tools/evemu-record.c b/tools/evemu-record.c
index 305bfe5..eedf4fa 100644
--- a/tools/evemu-record.c
+++ b/tools/evemu-record.c
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
}
fd = open(device, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- fprintf(stderr, "error: could not open device\n");
+ fprintf(stderr, "error: could not open device (%m)\n");
return -1;
}
@@ -116,11 +116,11 @@ int main(int argc, char *argv[])
act.sa_handler = &handler;
if (sigaction(SIGTERM, &act, NULL) < 0) {
- fprintf (stderr, "Could not attach TERM signal handler.\n");
+ fprintf (stderr, "Could not attach TERM signal handler (%m)\n");
return 1;
}
if (sigaction(SIGINT, &act, NULL) < 0) {
- fprintf (stderr, "Could not attach INT signal handler.\n");
+ fprintf (stderr, "Could not attach INT signal handler (%m)\n");
return 1;
}
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
else {
output = fopen(argv[2], "w");
if (!output) {
- fprintf(stderr, "error: could not open output file");
+ fprintf(stderr, "error: could not open output file (%m)");
}
}
--
2.5.0
More information about the Input-tools
mailing list