3 do_socket(stab, arglast)
7 register STR **st = stack->ary_array;
8 register int sp = arglast[1];
10 int domain, type, protocol, fd;
19 stio = stab_io(stab) = stio_new();
23 domain = (int)str_gnum(st[++sp]);
24 type = (int)str_gnum(st[++sp]);
25 protocol = (int)str_gnum(st[++sp]);
26 TAINT_PROPER("socket");
27 fd = socket(domain,type,protocol);
30 stio->ifp = fdopen(fd, "r"); /* stdio gets confused about sockets */
31 stio->ofp = fdopen(fd, "w");
33 if (!stio->ifp || !stio->ofp) {
34 if (stio->ifp) fclose(stio->ifp);
35 if (stio->ofp) fclose(stio->ofp);
36 if (!stio->ifp && !stio->ofp) close(fd);