> Hi,
>
> I wonder if it is possible to redirect stdout/stderr to syslog.
>
> Background:
> I'm writing a program which starts (fork=>execvp) and observes
> another program. I would like to redirect all output of the "execvped"
> program to syslog.
>
> I know this is not really FBSD related but I hope you can help
> me anyway. Please don't tell me that I should redirect the output
> to a file and not to syslog. I know how to redirect the output to
> a file (that's my prog doing at present state).
I guess you could do something like:
int fd;
fd = open(_PATH_DEVNULL, O_RDONLY);
dup2(fd, STDIN_FILENO);
close(STDOUT_FILENO);
openlog(....);
dup2(STDOUT_FILENO, STDERR_FILENO);
> Bye,
> Alex
--
Brian <[EMAIL PROTECTED]> <brian@[uk.]FreeBSD.org>
<http://www.Awfulhak.org> <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message