summaryrefslogtreecommitdiff
path: root/net-dialup/sterm/files
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-05-17 08:41:02 +0200
committerKarel Kočí <cynerd@email.cz>2017-05-17 08:41:02 +0200
commit70eca9a5216a3769c14c05ad48219bbdbf1ff040 (patch)
tree3be07d9d4f9b1b417db7db3535dd53767e4f4357 /net-dialup/sterm/files
parentb9e35923da6bf013f2c582e921f6086900ad63b3 (diff)
downloadgentoo-personal-overlay-70eca9a5216a3769c14c05ad48219bbdbf1ff040.tar.gz
gentoo-personal-overlay-70eca9a5216a3769c14c05ad48219bbdbf1ff040.tar.bz2
gentoo-personal-overlay-70eca9a5216a3769c14c05ad48219bbdbf1ff040.zip
sterm add patch for more descriptive error messages
Diffstat (limited to 'net-dialup/sterm/files')
-rw-r--r--net-dialup/sterm/files/Print-more-descriptive-error-message.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/net-dialup/sterm/files/Print-more-descriptive-error-message.patch b/net-dialup/sterm/files/Print-more-descriptive-error-message.patch
new file mode 100644
index 0000000..9db1dad
--- /dev/null
+++ b/net-dialup/sterm/files/Print-more-descriptive-error-message.patch
@@ -0,0 +1,46 @@
+From 613b8407347b063320ebf408d06bb120293c6c3a Mon Sep 17 00:00:00 2001
+From: Michal Sojka <sojkam1@fel.cvut.cz>
+Date: Thu, 4 May 2017 00:00:10 +0200
+Subject: [PATCH] Print more descriptive error message
+
+---
+ sterm.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/sterm.c b/sterm.c
+index b375caf..ea86573 100644
+--- a/sterm.c
++++ b/sterm.c
+@@ -31,6 +31,7 @@
+
+ #define _BSD_SOURCE
+ #define _DEFAULT_SOURCE
++#define _GNU_SOURCE
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -44,6 +45,7 @@
+ #include <string.h>
+ #include <signal.h>
+ #include <lockdev.h>
++#include <errno.h>
+
+ #define STRINGIFY(val) #val
+ #define TOSTRING(val) STRINGIFY(val)
+@@ -269,7 +271,12 @@ int main(int argc, char *argv[])
+ fprintf(stderr, "%s is used by PID %d\n", dev, pid);
+ exit(1);
+ } else if (pid < 0) {
+- perror("dev_lock()");
++ char *msg;
++ asprintf(&msg, "dev_lock('%s')", dev); /* No free() because we exit() immediately */
++ if (errno)
++ perror(msg);
++ else
++ fprintf(stderr, "%s: Error\n", msg);
+ exit(1);
+ }
+ atexit(unlock);
+--
+2.13.0
+