From 70eca9a5216a3769c14c05ad48219bbdbf1ff040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 17 May 2017 08:41:02 +0200 Subject: sterm add patch for more descriptive error messages --- .../Print-more-descriptive-error-message.patch | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 net-dialup/sterm/files/Print-more-descriptive-error-message.patch (limited to 'net-dialup/sterm/files/Print-more-descriptive-error-message.patch') 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 +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 + #include + #include +@@ -44,6 +45,7 @@ + #include + #include + #include ++#include + + #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 + -- cgit v1.2.3