diff --git a/lib/core/context.c b/lib/core/context.c
index 4bd2b05aa93321278f87cb894f7e0ac19a3831e1..cab88616f63ec74280f7739141efc481f6b60e45 100644
--- a/lib/core/context.c
+++ b/lib/core/context.c
@@ -823,7 +823,7 @@ lws_create_context(const struct lws_context_creation_info *info)
 	struct lws_context *context = NULL;
 	struct lws_plat_file_ops *prev;
 #ifndef LWS_NO_DAEMONIZE
-	int pid_daemon = get_daemonize_pid();
+	pid_t pid_daemon = get_daemonize_pid();
 #endif
 	int n;
 #if defined(__ANDROID__)
@@ -934,7 +934,7 @@ lws_create_context(const struct lws_context_creation_info *info)
 #ifndef LWS_NO_DAEMONIZE
 	if (pid_daemon) {
 		context->started_with_parent = pid_daemon;
-		lwsl_info(" Started with daemon pid %d\n", pid_daemon);
+		lwsl_info(" Started with daemon pid %u\n", (unsigned int)pid_daemon);
 	}
 #endif
 #if defined(__ANDROID__)
diff --git a/lib/core/private.h b/lib/core/private.h
index c1a0a661b11ec4d5059bf61afa74842fe4a74ad4..4b210e6fd536572740270468daebb04db2993e09 100644
--- a/lib/core/private.h
+++ b/lib/core/private.h
@@ -696,7 +696,9 @@ struct lws_context {
 
 	int max_fds;
 	int count_event_loop_static_asset_handles;
-	int started_with_parent;
+#if !defined(LWS_NO_DAEMONIZE)
+	pid_t started_with_parent;
+#endif
 	int uid, gid;
 
 	int fd_random;
diff --git a/lib/misc/daemonize.c b/lib/misc/daemonize.c
index b41609f48ad8fe7e8c232b0abcbf1d2a30a2566b..52fd6ea053feca80f48529d8bf7ed613a4d20f65 100644
--- a/lib/misc/daemonize.c
+++ b/lib/misc/daemonize.c
@@ -28,10 +28,10 @@
 
 #include "core/private.h"
 
-unsigned int pid_daemon;
+pid_t pid_daemon;
 static char *lock_path;
 
-int get_daemonize_pid()
+pid_t get_daemonize_pid()
 {
 	return pid_daemon;
 }
diff --git a/lib/plat/unix/unix-service.c b/lib/plat/unix/unix-service.c
index e61ef59959cb25ff0e8ce2b4fcaa7d48abe74f86..b2c05ea548673807f0debe9407847ed48e41e5a9 100644
--- a/lib/plat/unix/unix-service.c
+++ b/lib/plat/unix/unix-service.c
@@ -197,8 +197,10 @@ lws_plat_service(struct lws_context *context, int timeout_ms)
 void
 lws_plat_service_periodic(struct lws_context *context)
 {
+#if !defined(LWS_NO_DAEMONIZE)
 	/* if our parent went down, don't linger around */
 	if (context->started_with_parent &&
 	    kill(context->started_with_parent, 0) < 0)
 		kill(getpid(), SIGTERM);
+#endif
 }
diff --git a/test-apps/test-server.c b/test-apps/test-server.c
index 2319cb49f8e3198319a3eb991f949c4557dee704..99e0e779a59b1d2371bb88c173b0bf67b376ab8c 100644
--- a/test-apps/test-server.c
+++ b/test-apps/test-server.c
@@ -363,9 +363,6 @@ int main(int argc, char **argv)
 #ifndef LWS_NO_DAEMONIZE
 		case 'D':
 			daemonize = 1;
-			#if !defined(_WIN32) && !defined(__sun)
-			syslog_options &= ~LOG_PERROR;
-			#endif
 			break;
 #endif
 		case 'u':