- patch from Denis Vlasenko to add and use bb_xchdir()
[oweals/busybox.git] / networking / telnetd.c
index 3e4b42cfaad9d0e8af1754c28da7506b9c5cbbe5..1a53c0c0ccf3ed830fb86f6988ced32f8debee36 100644 (file)
@@ -1,4 +1,4 @@
-/* vi:set ts=4:*/
+/* vi: set sw=4 ts=4: */
 /*
  * Simple telnet server
  * Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
@@ -461,17 +461,9 @@ telnetd_main(int argc, char **argv)
        sa.sin_addr = bind_addr;
 #endif
 
-       if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
-               bb_perror_msg_and_die("bind");
-       }
-
-       if (listen(master_fd, 1) < 0) {
-               bb_perror_msg_and_die("listen");
-       }
-
-       if (daemon(0, 0) < 0)
-               bb_perror_msg_and_die("daemon");
-
+       bb_xbind(master_fd, (struct sockaddr *) &sa, sizeof(sa));
+       bb_xlisten(master_fd, 1);
+       bb_xdaemon(0, 0);
 
        maxfd = master_fd;
 #endif /* CONFIG_FEATURE_TELNETD_INETD */