1734. [cleanup] 'rndc-confgen -a -t' remove extra '/' in path.
[RT #12588]
-1733. [placeholder] rt12658
+1733. [bug] Return non-zero exit status on initial load failure.
+ [RT #12658]
1732. [placeholder] rt12467
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.428 2004/06/18 04:38:45 marka Exp $ */
+/* $Id: server.c,v 1.429 2004/09/29 06:45:37 marka Exp $ */
#include <config.h>
isc_result_t result;
ns_server_t *server = (ns_server_t *)event->ev_arg;
- UNUSED(task);
+ INSIST(task == server->task);
isc_event_free(&event);
isc_hash_init();
- CHECKFATAL(load_zones(server, ISC_FALSE),
- "loading zones");
+ CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
+ ns_os_started();
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
- ISC_LOG_INFO, "running");
+ ISC_LOG_NOTICE, "running");
}
void
start_reserved_dispatches(server);
result = load_configuration(ns_g_lwresdonly ?
lwresd_g_conffile : ns_g_conffile,
- server,
- ISC_FALSE);
+ server, ISC_FALSE);
if (result == ISC_R_SUCCESS)
end_reserved_dispatches(server, ISC_FALSE);
else
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.h,v 1.22 2004/03/05 04:58:05 marka Exp $ */
+/* $Id: os.h,v 1.23 2004/09/29 06:45:37 marka Exp $ */
#ifndef NS_OS_H
#define NS_OS_H 1
void
ns_os_tzset(void);
+void
+ns_os_started(void);
+
#endif /* NS_OS_H */
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.69 2004/09/16 02:49:41 marka Exp $ */
+/* $Id: os.c,v 1.70 2004/09/29 06:45:37 marka Exp $ */
#include <config.h>
#include <stdarg.h>
static struct passwd *runas_pw = NULL;
static isc_boolean_t done_setuid = ISC_FALSE;
+static int dfd[2] = { -1, -1 };
#ifdef HAVE_LINUX_CAPABILITY_H
pid_t pid;
char strbuf[ISC_STRERRORSIZE];
+ if (pipe(dfd) == -1) {
+ isc__strerror(errno, strbuf, sizeof(strbuf));
+ ns_main_earlyfatal("pipe(): %s", strbuf);
+ }
+
pid = fork();
if (pid == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf));
ns_main_earlyfatal("fork(): %s", strbuf);
}
- if (pid != 0)
- _exit(0);
+ if (pid != 0) {
+ int n;
+ /*
+ * Wait for the child to finish loading for the first time.
+ * This would be so much simpler if fork() worked once we
+ * were multi-threaded.
+ */
+ (void)close(dfd[1]);
+ do {
+ char buf;
+ n = read(dfd[0], &buf, 1);
+ if (n == 1)
+ _exit(0);
+ } while (n == -1 && errno == EINTR);
+ _exit(1);
+ }
+ (void)close(dfd[0]);
/*
* We're the child.
}
}
+void
+ns_os_started(void) {
+ char buf = 0;
+
+ /*
+ * Signal to the parent that we stated successfully.
+ */
+ if (dfd[0] != -1 && dfd[1] != -1) {
+ write(dfd[1], &buf, 1);
+ close(dfd[1]);
+ dfd[0] = dfd[1] = -1;
+ }
+}
+
void
ns_os_opendevnull(void) {
devnullfd = open("/dev/null", O_RDWR, 0);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.h,v 1.9 2004/03/05 04:58:11 marka Exp $ */
+/* $Id: os.h,v 1.10 2004/09/29 06:45:38 marka Exp $ */
#ifndef NS_OS_H
#define NS_OS_H 1
void
ns_os_tzset(void);
+void
+ns_os_started(void);
+
#endif /* NS_OS_H */
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.20 2004/03/05 04:58:08 marka Exp $ */
+/* $Id: os.c,v 1.21 2004/09/29 06:45:38 marka Exp $ */
#include <config.h>
#include <stdarg.h>
tzset();
#endif
}
+
+void
+ns_os_started(void) {
+}