Re: g_file_write()

Ack, you did use fchmod, sorry.

Two things regarding the fork approach:

1. It is hideously expensive.

2. It is quite difficult to get right in a library.

Consider: you fork, the child does its thing and exits,
a signal handler you didn't know about waits on the child,
and you call waitpid.

If you are lucky, that waitpid just returns an error (ECHILD).
Your code then accesses "status" which hasn't been set.

If you are less lucky (aka the OS and the application programmer
are out to get you), then the waitpid will hang waiting for another
process.  You can probably ignore this.

waitpid can also fail for other reasons.  A signal could cause
EINTR, for example.

(And then there is the usual should-have-saved errno comment.
_() could have changed it.)

Why 0666 and not 0777, btw.?  One could conveniently write scripts
this way.

Tell me again why we want this function to be anything but the
simple open+write+close?


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