|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Re: [Xen-changelog] [xen-unstable] xenstored: Do not wri
Good idea. Can't use _PATH_DEVNULL easily though, since it'll break Solaris
again (no paths.h). Hardcoding /dev/null is not so bad -- the console daemon
does this already.
-- Keir
On 1/8/07 19:20, "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> Yep, rather than closing FD's and setting the FILE* to NULL, the daeon
> code should re-open /dev/null for stdin/out/err which is the traditional
> approach for most UNIX daemons.
>
> if (dofork) {
> int devnull;
> devnull = open(_PATH_DEVNULL, O_RDWR);
> close(STDIN_FILENO);
> close(STDOUT_FILENO);
> close(STDERR_FILENO);
> dup2(devnull, STDIN_FILENO);
> dup2(devnull, STDOUT_FILENO);
> dup2(devnull, STDERR_FILENO);
> close(devnull);
> }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|