rtpproxy
rtpproxy copied to clipboard
not work if file descriptor 0 is closed
Hi,
I need to start rtpproxy from a daemon, which will close default file descriptors like: STDIN, STDOUT, STDERR.
But rtpproxy will not work properly then.
Here is a small reproducible example:
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
close(0);
if (-1 == system("rtpproxy -p /var/run/rtpproxy.pid -s unix:/var/run/rtpproxy.sock -RF")) {
fprintf(stderr, "system: %m\n");
assert(0);
}
return 0;
}
check status by:
ls -lR /proc/$(pgrep rtpproxy)/fd 2> /dev/null; netstat -naxp | grep rtpproxy
unix socket not open properly.
not only rtpproxy, seems all programs which have unix socket listen stuff do not work well.