]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: Fix re-exec when haproxy is started from PATH
authorTim Duesterhus <tim@bastelstu.be>
Sun, 12 Nov 2017 16:39:18 +0000 (17:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 14 Nov 2017 14:11:24 +0000 (15:11 +0100)
If haproxy is started using the name of the binary only (i.e.
not using a relative or absolute path) the `execv` in
`mworker_reload` fails with `ENOENT`, because it does not
examine the `PATH`:

  [WARNING] 315/161139 (7) : Reexecuting Master process
  [WARNING] 315/161139 (7) : Cannot allocate memory
  [WARNING] 315/161139 (7) : Failed to reexecute the master processs [7]

The error messages are misleading, because the return value of
`execv` is not checked. This should be fixed in a separate commit.

Once this happened the master process ignores any further
signals sent by the administrator.

Replace `execv` with `execvp` to establish the expected
behaviour.

This bug was introduced in commit 73b85e75b3963086be889e1fb40a59e7ef2ad63b.

src/haproxy.c

index a22ed321f0392ced492c9f8af1f563d681846c33..b4f6a4f880cdd035a65f0c119b8aa92861783802 100644 (file)
@@ -650,7 +650,7 @@ static void mworker_reload()
 
        deinit(); /* we don't want to leak FD there */
        Warning("Reexecuting Master process\n");
-       execv(next_argv[0], next_argv);
+       execvp(next_argv[0], next_argv);
 
 alloc_error:
        Warning("Cannot allocate memory\n");