Fixes bug 8131
Note: process will not daemonise until name is resolved
---
 networking/ntpd.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/networking/ntpd.c b/networking/ntpd.c
index 9732c9b..3273cdd 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -766,7 +766,14 @@ add_peers(const char *s)
        peer_t *p;
 
        p = xzalloc(sizeof(*p));
-       p->p_lsa = xhost2sockaddr(s, 123);
+
+       /* loop until ip is resolved */
+       while (true) {
+               p->p_lsa = host2sockaddr(s, 123);
+               if( p->p_lsa != NULL )
+                       break;
+               sleep(1);
+       }
        p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa);
        p->p_fd = -1;
        p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3);
-- 
1.9.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to