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

Re: The open() system call in f8 really broken...



On Wed, Aug 15, 2007 at 08:56:10PM -0400, Steve Dickson wrote:
> and the following change stops the error:
> 
> - if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
> + if ((fd = (open)(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
>           xlog(L_WARNING, "could not open %s for locking", fname);
>           return -1;
>    }
> 
> Which does not change the fact I'm using O_CREAT w/out a mode
> So what is the point of killing the process???
> 
> Now If I'm not mistaken, its been legal since the 70s to use
> O_CREAT without a mode because (depending on the OS) the mode
> of parent directory will be used (or something similar)...

Sorry ignore the previous email I misunderstood what was going on.

You can open a file O_CREAT with neither read or write, you can open a file
with O_CREAT|O_WRONLY but not give permissions in the file mode. You must
provide the third argument so the abort is right. If you don't then the permissions
are set based on the random values (eg the return address)


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