summaryrefslogtreecommitdiff
path: root/do/connect
diff options
context:
space:
mode:
Diffstat (limited to 'do/connect')
-rw-r--r--do/connect29
1 files changed, 29 insertions, 0 deletions
diff --git a/do/connect b/do/connect
new file mode 100644
index 0000000000..08230d2411
--- /dev/null
+++ b/do/connect
@@ -0,0 +1,29 @@
+int
+do_connect(stab, arglast)
+STAB *stab;
+int *arglast;
+{
+ register STR **st = stack->ary_array;
+ register int sp = arglast[1];
+ register STIO *stio;
+ char *addr;
+
+ if (!stab)
+ goto nuts;
+
+ stio = stab_io(stab);
+ if (!stio || !stio->ifp)
+ goto nuts;
+
+ addr = str_get(st[++sp]);
+ TAINT_PROPER("connect");
+ return connect(fileno(stio->ifp), addr, st[sp]->str_cur) >= 0;
+
+nuts:
+ if (dowarn)
+ warn("connect() on closed fd");
+ errno = EBADF;
+ return FALSE;
+
+}
+