Revision: 23092 http://trac.macosforge.org/projects/launchd/changeset/23092 Author: zarzycki@apple.com Date: 2007-02-20 08:57:11 -0800 (Tue, 20 Feb 2007) Log Message: ----------- Workaround 4978696: getifaddrs() reports false ENOMEM Modified Paths: -------------- trunk/launchd/src/launchd.c Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2007-02-20 14:01:28 UTC (rev 23091) +++ trunk/launchd/src/launchd.c 2007-02-20 16:57:11 UTC (rev 23092) @@ -64,6 +64,7 @@ #include <string.h> #include <setjmp.h> #include <spawn.h> +#include <sched.h> #include "libbootstrap_public.h" #include "libvproc_public.h" @@ -341,8 +342,15 @@ { struct ifaddrs *ifa, *ifai; bool up = false; + int r; - if (!launchd_assumes(getifaddrs(&ifa) != -1)) { + /* Workaround 4978696: getifaddrs() reports false ENOMEM */ + while ((r = getifaddrs(&ifa)) == -1 && errno == ENOMEM) { + runtime_syslog(LOG_DEBUG, "Worked around bug: 4978696"); + launchd_assumes(sched_yield() != -1); + } + + if (!launchd_assumes(r != -1)) { return network_up; }