#endif
-#if 0
+#ifdef _WIN32
+
+int
+fork_exec(so, ex, do_pty)
+ struct socket *so;
+ char *ex;
+ int do_pty;
+{
+ /* not implemented */
+ return 0;
+}
+
+#else
+
int
-openpty(amaster, aslave)
- int *amaster, *aslave;
+slirp_openpty(amaster, aslave)
+ int *amaster, *aslave;
{
register int master, slave;
int opt;
int master;
char *argv[256];
+#if 0
char buff[256];
+#endif
/* 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);
DEBUG_ARG("do_pty = %lx", (long)do_pty);
if (do_pty == 2) {
- if (openpty(&master, &s) == -1) {
+ if (slirp_openpty(&master, &s) == -1) {
lprint("Error: openpty failed: %s\n", strerror(errno));
return 0;
}
*/
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
if (x_port >= 0) {
#ifdef HAVE_SETENV
sprintf(buff, "%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen);
putenv(buff);
#endif
}
-
+#endif
dup2(s, 0);
dup2(s, 1);
dup2(s, 2);
* 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;
return 0;
}
#else
- if (openpty(&fd0[0], &fd0[1]) == -1) {
+ if (slirp_openpty(&fd0[0], &fd0[1]) == -1) {
close(fd[0]);
close(fd[1]);
lprint("Error: openpty failed: %s\n", strerror(errno));