[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] [Mint-cvs] [FreeMiNT CVS] mintlib/unix
On 11/01/15 19:27, Helmut Karlowski wrote:
> Am 11.01.2015, 18:51 Uhr, schrieb Alan Hourihane:
>
>> Hi Helmut,
>>
>> Did you commit this to the MiNTlib branch ?
>>
>> Just checking if it needs the version of MiNT checking differently or
>> does this work with older kernels ?
>>
>>> - if (rv >= 0 && __mint >= 9 && (/* __mint <= 0x109 ?
>>> - S_ISFIFO(sb.st_mode) : */
>>> - (major((dev_t) sb.st_rdev) == major(PIPE_RDEV)))
>>> + if (rv >= 0 && __mint >= 9 && !(iomode & O_DENYNONE)
>>> + && (major((dev_t) sb.st_rdev) == major(PIPE_RDEV))
>
> I removed the commented code and added && !(iomode & O_DENYNONE). No
> affect on MiNT-version.
O.k. great.
>
> While you're at it:
>
> What's that:
>
> if (rv >= 0) {
> struct stat statbuf;
> sb.st_mode = 0;
>
> /*
> Problem: Why is sb.st_mode set to 0
> and
> why do we check then for a fifo???
> */
> if (fstat(rv,&statbuf) != 0
> || !S_ISFIFO(sb.st_mode)) {
> (void)Fclose(rv);
> rv =
> (int)failsafe_Fopen(filename,iomode & modemask);
> }
> }
>
>
> I mean the comment.
Well, I've no idea, I didn't write the code.
But having looked at it, it's wrapped up when __mint < 9, so it looks as
though it's tied
to really old kernels. But also, it's more than just a comment,
sb.st_mode really is
set to 0 above the comment, and then the S_ISFIFO check.
The code seems broken for these really old kernels.
Alan.