mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUG/MINOR: systemd: check return value of calloc()
The wrapper is not the best reliable thing in the universe, so start by adding at least the minimum expected controls :-/ To be backported to 1.5 and 1.6.
This commit is contained in:
parent
4351ea61fb
commit
3747ea07ce
@ -77,11 +77,17 @@ static void spawn_haproxy(char **pid_strv, int nb_pid)
|
|||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
/* 3 for "haproxy -Ds -sf" */
|
char **argv;
|
||||||
char **argv = calloc(4 + main_argc + nb_pid + 1, sizeof(char *));
|
|
||||||
int i;
|
int i;
|
||||||
int argno = 0;
|
int argno = 0;
|
||||||
|
|
||||||
|
/* 3 for "haproxy -Ds -sf" */
|
||||||
|
argv = calloc(4 + main_argc + nb_pid + 1, sizeof(char *));
|
||||||
|
if (!argv) {
|
||||||
|
fprintf(stderr, SD_NOTICE "haproxy-systemd-wrapper: failed to calloc(), please try again later.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
reset_signal_handler();
|
reset_signal_handler();
|
||||||
locate_haproxy(haproxy_bin, 512);
|
locate_haproxy(haproxy_bin, 512);
|
||||||
argv[argno++] = haproxy_bin;
|
argv[argno++] = haproxy_bin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user