From 687b3d7ae106632a1d9446fcd1f49e3d28dd5793 Mon Sep 17 00:00:00 2001 From: tick Date: Mon, 12 Nov 2007 09:41:03 +0000 Subject: gsmd: return some meaningful value from set_baudrate (Andrew & Tick) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3392 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/gsmd.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c index 65254ed..ebc9126 100644 --- a/src/gsmd/gsmd.c +++ b/src/gsmd/gsmd.c @@ -277,23 +277,26 @@ static int set_baudrate(int fd, int baudrate, int hwflow) return -EINVAL; i = tcgetattr(fd, &ti); - if (i < 0) - return i; + if (i < 0) { + return -errno; + } i = cfsetispeed(&ti, B0); - if (i < 0) - return i; + if (i < 0) { + return -errno; + } i = cfsetospeed(&ti, bd); - if (i < 0) - return i; + if (i < 0) { + return -errno; + } if (hwflow) ti.c_cflag |= CRTSCTS; else ti.c_cflag &= ~CRTSCTS; - return tcsetattr(fd, 0, &ti); + return tcsetattr(fd, 0, &ti) ? -errno : 0; } static int gsmd_initialize(struct gsmd *g) -- cgit v1.2.3