summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-11-12 09:41:03 +0000
committertick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-11-12 09:41:03 +0000
commit687b3d7ae106632a1d9446fcd1f49e3d28dd5793 (patch)
treede5f83d348f17277e318afbda77a826ace538f9f
parent54119f964d25ebeef9a0f300c5e7edb7f0269a23 (diff)
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
-rw-r--r--src/gsmd/gsmd.c17
1 files changed, 10 insertions, 7 deletions
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)
personal git repositories of Harald Welte. Your mileage may vary