Re: Blocking on IO ...



Michael Meeks <michael ximian com> writes:
> +  g_assert (chdir ("/") == 0);

This should come out of the assert, or it breaks if you
G_DISABLE_ASSERT. (Also as a matter of code clarity, I always assume
assertions don't contain important functionality.)

If it was worth it to check this error (and I don't think it really
is), I would write:
 if (chdir ("/") < 0)
   {
     fprintf (stderr, "Could not change to root directory: %s\n",
              g_strerror (errno));
     exit (1);
   }

> +
> +  dev_null_fd = open ("/dev/null", O_RDWR);
> +  if (dev_null_fd >= 0) {
> +	  dup2 (dev_null_fd, 0);
> +	  dup2 (dev_null_fd, 1);
> +	  dup2 (dev_null_fd, 2);
> +  }
> 

Looks good, let's do this.
 
> 	Of course - ideally we'd have an environment variable to let it
> all spew to the console where it can be easily caught - is that
> interesting ?

Not for gconf's spew, which never goes to stdout/stderr (g_warning()
etc. are even redirected to syslog IIRC), but perhaps if you want
other module's spew redirected. I don't have any objection to a patch
doing that.

Havoc





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]