Takeshi Ideriha - 2021-10-13

Hi

While reading the source code,
I found that the argument of execl() and execlp() is not specified properly.

According to "man execl", the last argument execl() or execlp() should be "(char )NULL".
However, "NULL" is specified instead of "(char
)NULL" in the source code:
- agent/lib/port.c: execl("/bin/sh", "sh", "-c", cmd, NULL)
- agent/bin/maintenance.c: execlp("/bin/sh", "sh", "-c", command, NULL)

https://man7.org/linux/man-pages/man3/exec.3.html

Specifying "NULL" seems harmless on many environments, but according to the following website
"NULL" and "(char *)NULL" is different to be precise and gcc gives warning.
I suspect this may cause undefined behavior of execl() or execlp(),
such that pg_statsinfo launcher process crashes unexpectedly
or pg_statsinfod process cannot be launched.

http://linuxonly.nl/docs/2/2_Sentinel_warning_missing_sentinel_in_function_call.html

I think that "NULL" should be fixed to "(char *)NULL".
Would you fix it?

Regards,
Takeshi Ideriha