* [B.A.T.M.A.N.] [PATCH] alfred: add more debug output for libc errors
@ 2014-07-29 16:06 Sven Eckelmann
2014-07-30 15:37 ` Simon Wunderlich
0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2014-07-29 16:06 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
perror(..) can automatically decode the errno variable and print more
information for an error.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
gpsd/alfred-gpsd.c | 2 +-
main.c | 2 +-
send.c | 2 +-
vis/vis.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gpsd/alfred-gpsd.c b/gpsd/alfred-gpsd.c
index 6e88dc7..d736ad1 100644
--- a/gpsd/alfred-gpsd.c
+++ b/gpsd/alfred-gpsd.c
@@ -443,7 +443,7 @@ static struct globals *gpsd_init(int argc, char *argv[])
gpsd_source_spec(NULL, &globals->gpsdsource);
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
- fprintf(stderr, "could not register SIGPIPE handler\n");
+ perror("could not register SIGPIPE handler");
return globals;
}
diff --git a/main.c b/main.c
index 0a79e08..1add44e 100644
--- a/main.c
+++ b/main.c
@@ -150,7 +150,7 @@ static struct globals *alfred_init(int argc, char *argv[])
}
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
- fprintf(stderr, "could not register SIGPIPE handler\n");
+ perror("could not register SIGPIPE handler");
return globals;
}
diff --git a/send.c b/send.c
index dc0e428..32b7cbb 100644
--- a/send.c
+++ b/send.c
@@ -170,7 +170,7 @@ ssize_t send_alfred_packet(struct globals *globals, const struct in6_addr *dest,
(struct sockaddr *)&dest_addr,
sizeof(struct sockaddr_in6));
if (ret == -EPERM) {
- fprintf(stderr, "Error during sent\n");
+ perror("Error during sent");
netsock_close(globals->netsock);
globals->netsock = -1;
}
diff --git a/vis/vis.c b/vis/vis.c
index 6cc4034..00372ab 100644
--- a/vis/vis.c
+++ b/vis/vis.c
@@ -258,7 +258,7 @@ static int register_interfaces(struct globals *globals)
path_buff = malloc(PATH_BUFF_LEN);
if (!path_buff) {
- fprintf(stderr, "Error - could not allocate path buffer: out of memory ?\n");
+ perror("Error - could not allocate path buffer");
goto err;
}
@@ -880,7 +880,7 @@ static struct globals *vis_init(int argc, char *argv[])
}
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
- fprintf(stderr, "could not register SIGPIPE handler\n");
+ perror("could not register SIGPIPE handler");
return globals;
}
--
2.0.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] alfred: add more debug output for libc errors
2014-07-29 16:06 [B.A.T.M.A.N.] [PATCH] alfred: add more debug output for libc errors Sven Eckelmann
@ 2014-07-30 15:37 ` Simon Wunderlich
0 siblings, 0 replies; 2+ messages in thread
From: Simon Wunderlich @ 2014-07-30 15:37 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
[-- Attachment #1: Type: Text/Plain, Size: 212 bytes --]
> perror(..) can automatically decode the errno variable and print more
> information for an error.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Applied in commit c9f5a5d.
Thanks
Simon
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-30 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29 16:06 [B.A.T.M.A.N.] [PATCH] alfred: add more debug output for libc errors Sven Eckelmann
2014-07-30 15:37 ` Simon Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).