alfred: add more debug output for libc errors
PATCH 1/1 alfred: add more debug output for libc errors
perror(..) can automatically decode the errno variable and print more information for an error.
Signed-off-by Sven Eckelmann <[email protected]>
--- gpsd/alfred-gpsd.c | 2 +- main.c | 2 +- send.c | 2 +- vis/vis.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-)
gpsd/alfred-gpsd.c +1 -1
@@ -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; }
main.c +1 -1
@@ -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; }
send.c +1 -1
@@ -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 ; }
vis/vis.c +2 -2
@@ -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; }
Signature · 1 line
2.0.1
Simon Wunderlich
AppliedQuoted 4 lines
perror(..) can automatically decode the errno variable and print more information for an error.
Signed-off-by Sven Eckelmann <[email protected]>
Applied in commit c9f5a5d.
Thanks
Simon