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.

41 lines
1.5 KiB

  1. From 3bc0a399d2875e9e0627a70906c1403eef60ec60 Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Tue, 25 Oct 2016 16:51:40 +0200
  4. Subject: [PATCH 15/26] MINOR: systemd: report it when execve() fails
  5. It's important to know that a signal sent to the wrapper had no effect
  6. because something failed during execve(). Ideally more info (strerror)
  7. should be reported. It would be nice to backport this to 1.6 and 1.5.
  8. (cherry picked from commit a785269b4e09114224062081f02b443b6008c524)
  9. ---
  10. src/haproxy-systemd-wrapper.c | 5 +++++
  11. 1 file changed, 5 insertions(+)
  12. diff --git a/src/haproxy-systemd-wrapper.c b/src/haproxy-systemd-wrapper.c
  13. index 15c48ca..f4fcab1 100644
  14. --- a/src/haproxy-systemd-wrapper.c
  15. +++ b/src/haproxy-systemd-wrapper.c
  16. @@ -107,8 +107,12 @@ static void spawn_haproxy(char **pid_strv, int nb_pid)
  17. fprintf(stderr, "\n");
  18. execv(argv[0], argv);
  19. + fprintf(stderr, SD_NOTICE "haproxy-systemd-wrapper: execv(%s) failed, please try again later.\n", argv[0]);
  20. exit(1);
  21. }
  22. + else if (pid == -1) {
  23. + fprintf(stderr, SD_NOTICE "haproxy-systemd-wrapper: failed to fork(), please try again later.\n");
  24. + }
  25. }
  26. static int read_pids(char ***pid_strv)
  27. @@ -180,6 +184,7 @@ static void do_restart(int sig)
  28. execv(wrapper_argv[0], wrapper_argv);
  29. /* failed, let's reinstall the signal handler and continue */
  30. setup_signal_handler();
  31. + fprintf(stderr, SD_NOTICE "haproxy-systemd-wrapper: re-exec(%s) failed.\n", wrapper_argv[0]);
  32. }
  33. /* handles SIGTERM and SIGINT only */
  34. --
  35. 2.7.3