From 42a3c0412aff03be1f6a37e6294b389b10e233f2 Mon Sep 17 00:00:00 2001 From: Dan Newman Date: Sat, 30 May 2015 16:29:43 -0700 Subject: [PATCH] Missing return 1 in gpx_sio_open(). Remove exit() calls in gpx_sio_open() and match style of gpx_sio_open() in winsio.c by returning 0 for errors rathern then exit() for errors. --- src/gpx/gpx-main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gpx/gpx-main.c b/src/gpx/gpx-main.c index 1f4aea2..43de5e2 100644 --- a/src/gpx/gpx-main.c +++ b/src/gpx/gpx-main.c @@ -220,17 +220,17 @@ int gpx_sio_open(Gpx *gpx, const char *filename, speed_t baud_rate, // open and configure the serial port if((port = open(filename, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) { perror("Error opening port"); - exit(-1); + return 0; } if(fcntl(port, F_SETFL, O_RDWR) < 0) { perror("Setting port descriptor flags"); - exit(-1); + return 0; } if(tcgetattr(port, &tp) < 0) { perror("Error getting port attributes"); - exit(-1); + return 0; } cfmakeraw(&tp); @@ -275,18 +275,20 @@ int gpx_sio_open(Gpx *gpx, const char *filename, speed_t baud_rate, if(tcsetattr(port, TCSANOW, &tp) < 0) { perror("Error setting port attributes"); - exit(-1); + return 0; } sleep(2); if(tcflush(port, TCIOFLUSH) < 0) { perror("Error flushing port"); - exit(-1); + return 0; } if(gpx->flag.verboseMode) fprintf(gpx->log, "Communicating via: %s" EOL, filename); if(sio_port) *sio_port = port; + + return 1; } #endif