diff svr-main.c @ 910:89555751c489 asm

merge up to 2013.63, improve ASM makefile rules a bit
author Matt Johnston <matt@ucc.asn.au>
date Thu, 27 Feb 2014 21:35:58 +0800
parents 860e3522f8fc
children 0bb16232e7c4
line wrap: on
line diff
--- a/svr-main.c	Sun Oct 06 22:32:03 2013 +0800
+++ b/svr-main.c	Thu Feb 27 21:35:58 2014 +0800
@@ -28,7 +28,8 @@
 #include "buffer.h"
 #include "signkey.h"
 #include "runopts.h"
-#include "random.h"
+#include "dbrandom.h"
+#include "crypto_desc.h"
 
 static size_t listensockets(int *sock, size_t sockcount, int *maxfd);
 static void sigchld_handler(int dummy);
@@ -136,6 +137,11 @@
 		dropbear_exit("No listening ports available.");
 	}
 
+	for (i = 0; i < listensockcount; i++) {
+		set_sock_priority(listensocks[i], DROPBEAR_PRIO_LOWDELAY);
+		FD_SET(listensocks[i], &fds);
+	}
+
 	/* fork */
 	if (svr_opts.forkbg) {
 		int closefds = 0;
@@ -331,6 +337,8 @@
 static void sigchld_handler(int UNUSED(unused)) {
 	struct sigaction sa_chld;
 
+	const int saved_errno = errno;
+
 	while(waitpid(-1, NULL, WNOHANG) > 0); 
 
 	sa_chld.sa_handler = sigchld_handler;
@@ -338,13 +346,14 @@
 	if (sigaction(SIGCHLD, &sa_chld, NULL) < 0) {
 		dropbear_exit("signal() error");
 	}
+	errno = saved_errno;
 }
 
 /* catch any segvs */
 static void sigsegv_handler(int UNUSED(unused)) {
 	fprintf(stderr, "Aiee, segfault! You should probably report "
 			"this as a bug to the developer\n");
-	exit(EXIT_FAILURE);
+	_exit(EXIT_FAILURE);
 }
 
 /* catch ctrl-c or sigterm */
@@ -383,9 +392,11 @@
 		dropbear_exit("signal() error");
 	}
 
+	crypto_init();
+
 	/* Now we can setup the hostkeys - needs to be after logging is on,
 	 * otherwise we might end up blatting error messages to the socket */
-	loadhostkeys();
+	load_all_hostkeys();
 
     seedrandom();
 }