summaryrefslogtreecommitdiff
path: root/do/bind
diff options
context:
space:
mode:
Diffstat (limited to 'do/bind')
-rw-r--r--do/bind31
1 files changed, 31 insertions, 0 deletions
diff --git a/do/bind b/do/bind
new file mode 100644
index 0000000000..d5f669026f
--- /dev/null
+++ b/do/bind
@@ -0,0 +1,31 @@
+int
+do_bind(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]);
+#ifdef TAINT
+ taintproper("Insecure dependency in bind");
+#endif
+ return bind(fileno(stio->ifp), addr, st[sp]->str_cur) >= 0;
+
+nuts:
+ if (dowarn)
+ warn("bind() on closed fd");
+ errno = EBADF;
+ return FALSE;
+
+}
+