diff options
Diffstat (limited to 'do/accept')
-rw-r--r-- | do/accept | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/do/accept b/do/accept deleted file mode 100644 index dd0c203aeb..0000000000 --- a/do/accept +++ /dev/null @@ -1,51 +0,0 @@ -void -do_accept(TARG, nstab, gstab) -STR *TARG; -STAB *nstab; -STAB *gstab; -{ - register STIO *nstio; - register STIO *gstio; - int len = sizeof buf; - int fd; - - if (!nstab) - goto badexit; - if (!gstab) - goto nuts; - - gstio = stab_io(gstab); - nstio = stab_io(nstab); - - if (!gstio || !gstio->ifp) - goto nuts; - if (!nstio) - nstio = stab_io(nstab) = stio_new(); - else if (nstio->ifp) - do_close(nstab,FALSE); - - fd = accept(fileno(gstio->ifp),(struct sockaddr *)buf,&len); - if (fd < 0) - goto badexit; - nstio->ifp = fdopen(fd, "r"); - nstio->ofp = fdopen(fd, "w"); - nstio->type = 's'; - if (!nstio->ifp || !nstio->ofp) { - if (nstio->ifp) fclose(nstio->ifp); - if (nstio->ofp) fclose(nstio->ofp); - if (!nstio->ifp && !nstio->ofp) close(fd); - goto badexit; - } - - str_nset(TARG, buf, len); - return; - -nuts: - if (dowarn) - warn("accept() on closed fd"); - errno = EBADF; -badexit: - str_sset(TARG,&str_undef); - return; -} - |