diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-12-12 11:45:10 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-12-12 11:45:10 +0000 |
commit | 7b91a17212a0a16dd56a8731c345ecf29c366855 (patch) | |
tree | c79631fa05b7bb76d5f09bfb7fcd0f104238df83 /slirp/misc.c | |
parent | 585d0ed98b032cdd062b9d43a6d0ef478fc914e8 (diff) |
slirp fix for -smb command (Initial patch by Juergen Keil)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1172 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/misc.c')
-rw-r--r-- | slirp/misc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/slirp/misc.c b/slirp/misc.c index 5b809a853a..a58b631003 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -320,7 +320,7 @@ fork_exec(so, ex, do_pty) /* don't want to clobber the original */ char *bptr; char *curarg; - int c, i; + int c, i, ret; DEBUG_CALL("fork_exec"); DEBUG_ARG("so = %lx", (long)so); @@ -372,7 +372,9 @@ fork_exec(so, ex, do_pty) */ s = socket(AF_INET, SOCK_STREAM, 0); addr.sin_addr = loopback_addr; - connect(s, (struct sockaddr *)&addr, addrlen); + do { + ret = connect(s, (struct sockaddr *)&addr, addrlen); + } while (ret < 0 && errno == EINTR); } #if 0 @@ -436,8 +438,10 @@ fork_exec(so, ex, do_pty) * The only reason this will block forever is if socket() * of connect() fail in the child process */ - so->s = accept(s, (struct sockaddr *)&addr, &addrlen); - closesocket(s); + do { + so->s = accept(s, (struct sockaddr *)&addr, &addrlen); + } while (so->s < 0 && errno == EINTR); + closesocket(s); opt = 1; setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); opt = 1; |