Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

9 years ago
9 years ago
9 years ago
  1. From 198aa5cd7cf86d9c10dbdf24291e1f8afbb12410 Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Mon, 12 Jan 2015 06:18:31 -0600
  4. Subject: [PATCH 11/13] initialize setproctitle where needed
  5. ---
  6. src/usr.sbin/ntpd/ntpd.c | 16 ++++++++++++++++
  7. 1 file changed, 16 insertions(+)
  8. diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
  9. index f89532f..ea8cf70 100644
  10. --- a/src/usr.sbin/ntpd/ntpd.c
  11. +++ b/src/usr.sbin/ntpd/ntpd.c
  12. @@ -111,6 +111,11 @@ usage(void)
  13. #define POLL_MAX 8
  14. #define PFD_PIPE 0
  15. +/* Saves a copy of argv for setproctitle emulation */
  16. +#ifndef HAVE_SETPROCTITLE
  17. +static char **saved_argv;
  18. +#endif
  19. +
  20. int
  21. main(int argc, char *argv[])
  22. {
  23. @@ -134,6 +139,17 @@ main(int argc, char *argv[])
  24. log_init(1); /* log to stderr until daemonized */
  25. +#ifndef HAVE_SETPROCTITLE
  26. + int i;
  27. + /* Prepare for later setproctitle emulation */
  28. + saved_argv = calloc(argc + 1, sizeof(*saved_argv));
  29. + for (i = 0; i < argc; i++)
  30. + saved_argv[i] = strdup(argv[i]);
  31. + saved_argv[i] = NULL;
  32. + compat_init_setproctitle(argc, argv);
  33. + argv = saved_argv;
  34. +#endif
  35. +
  36. while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) {
  37. switch (ch) {
  38. case 'd':
  39. --
  40. 1.9.1