diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-01 20:37:40 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-01 20:37:40 +0800 |
commit | 377ba4293abaa4cc98b7bdee57e98528acbf023f (patch) | |
tree | 65d473b99ba32dce0eba09d2e6837102c80468f9 /src | |
parent | 98f6dd5cdce641599c52e8952fd17a14ffc12c56 (diff) |
Diffstat (limited to 'src')
-rw-r--r-- | src/msc_conn.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/msc_conn.c b/src/msc_conn.c index 66a1a0b..902546f 100644 --- a/src/msc_conn.c +++ b/src/msc_conn.c @@ -281,7 +281,7 @@ error: return -1; } -static void setnonblocking(struct bsc_fd *fd) +static int setnonblocking(struct bsc_fd *fd) { int flags; @@ -290,7 +290,7 @@ static void setnonblocking(struct bsc_fd *fd) perror("fcntl get failed"); close(fd->fd); fd->fd = -1; - return; + return -1; } flags |= O_NONBLOCK; @@ -299,8 +299,10 @@ static void setnonblocking(struct bsc_fd *fd) perror("fcntl get failed"); close(fd->fd); fd->fd = -1; - return; + return -1; } + + return 0; } static int connect_to_msc(struct bsc_fd *fd, const char *ip, int port, int tos) @@ -318,7 +320,8 @@ static int connect_to_msc(struct bsc_fd *fd, const char *ip, int port, int tos) } /* make it non blocking */ - setnonblocking(fd); + if (setnonblocking(fd) != 0) + return -1; memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; |