File ntp-processname.patch of Package ntp.3211

--- libntp/work_fork.c.orig
+++ libntp/work_fork.c
@@ -24,6 +24,8 @@
 	int			worker_process;
 	addremove_io_fd_func	addremove_io_fd;
 static	volatile int		worker_sighup_received;
+int	saved_argc = 0;
+char	**saved_argv;
 
 /* === function prototypes === */
 static	void		fork_blocking_child(blocking_child *);
@@ -495,6 +497,22 @@ fork_blocking_child(
 	worker_process = TRUE;
 
 	/*
+	 * Change the process name of the child to avoid confusion
+	 * about ntpd trunning twice.
+	 */
+	if (saved_argc != 0) {
+		int argcc;
+		int argvlen = 0;
+		/* Clear argv */
+		for (argcc = 0; argcc < saved_argc; argcc++) {
+			int l = strlen(saved_argv[argcc]);
+			argvlen += l + 1;
+			memset(saved_argv[argcc], 0, l);
+		}
+		strlcpy(saved_argv[0], "ntpd: asynchronous dns resolver", argvlen);
+	}
+
+	/*
 	 * In the child, close all files except stdin, stdout, stderr,
 	 * and the two child ends of the pipes.
 	 */
--- include/ntpd.h.orig
+++ include/ntpd.h
@@ -321,6 +321,8 @@ extern	void	parse_cmdline_opts(int *, ch
 
 /* ntp_config.c */
 extern char const *	progname;
+extern int saved_argc;
+extern char **saved_argv;
 extern char	*sys_phone[];		/* ACTS phone numbers */
 #if defined(HAVE_SCHED_SETSCHEDULER)
 extern int	config_priority_override;
--- ntpd/ntpd.c.orig
+++ ntpd/ntpd.c
@@ -230,8 +230,10 @@ static	RETSIGTYPE	no_debug	(int);
 # endif	/* !DEBUG */
 #endif	/* !SIM && !SYS_WINNT */
 
+#ifndef WORK_FORK
 int	saved_argc;
 char **	saved_argv;
+#endif
 
 #ifndef SIM
 int		ntpdmain		(int, char **);