rtpproxy icon indicating copy to clipboard operation
rtpproxy copied to clipboard

not work if file descriptor 0 is closed

Open wasphin opened this issue 9 years ago • 1 comments

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.

wasphin avatar Jun 22 '16 08:06 wasphin

not only rtpproxy, seems all programs which have unix socket listen stuff do not work well.

wasphin avatar Jun 23 '16 06:06 wasphin