aboutsummaryrefslogtreecommitdiff
path: root/toys/net
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-10-22 19:48:15 -0500
committerRob Landley <rob@landley.net>2020-10-22 19:48:15 -0500
commit660e6a384d8c7b32a8486a0aeb31f75939a99b75 (patch)
tree7607378be349e3ac4a7df9099c9a0075520f16e1 /toys/net
parent0030729a09896602b55571afb8be7fa9b29b730c (diff)
downloadtoybox-660e6a384d8c7b32a8486a0aeb31f75939a99b75.tar.gz
Add nommu-able xvdaemon() and use it to remove some TOYBOX_FORK dependencies
Diffstat (limited to 'toys/net')
-rw-r--r--toys/net/sntp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/net/sntp.c b/toys/net/sntp.c
index dae19485..161cab46 100644
--- a/toys/net/sntp.c
+++ b/toys/net/sntp.c
@@ -11,7 +11,6 @@ USE_SNTP(NEWTOY(sntp, ">1M :m :Sp:t#<0=1>16asdDqr#<4>17=10[!as]", TOYFLAG_USR|TO
config SNTP
bool "sntp"
default y
- depends on TOYBOX_FORK
help
usage: sntp [-saSdDq] [-r SHIFT] [-mM[ADDRESS]] [-p PORT] [SERVER]
@@ -79,6 +78,8 @@ void sntp_main(void)
union socksaddr sa;
int fd, tries = 0;
+ if (FLAG(d)) xvdaemon();
+
if (FLAG(M)) toys.optflags |= FLAG_S;
if (!(FLAG(S)||FLAG(m)) && !*toys.optargs)
error_exit("Need -SMm or SERVER address");
@@ -88,8 +89,6 @@ void sntp_main(void)
ai = xgetaddrinfo(*toys.optargs, TT.p, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
AI_PASSIVE*!*toys.optargs);
- if (FLAG(d) && daemon(0, 0)) perror_exit("daemonize");
-
// Act as server if necessary
if (FLAG(S)||FLAG(m)) {
fd = xbindany(ai);