On 30 October 2012 16:45, Okan Demirmen <[email protected]> wrote:
> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
> <[email protected]> wrote:
>> On 30 October 2012 15:03, Christiano F. Haesbaert
>> <[email protected]> wrote:
>>> On 30 October 2012 15:00, Mike Belopuhov <[email protected]> wrote:
>>>> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>>>> <[email protected]> wrote:
>>>>> On 30 October 2012 14:36, rustyBSD <[email protected]> wrote:
>>>>>> MMmhh...
>>>>>>
>>>>>> == /usr/src/usr.bin/mg/dired.c ==
>>>>>> Go look the line 729:
>>>>>>
>>>>>>     if ((fopen(dname,"r")) == NULL) {
>>>>>>         ...
>>>>>>
>>>>>> Now you can cry
>>>>>>
>>>>>
>>>>> What is your point ?
>>>>>
>>>>
>>>> you leak a FILE object and a descriptor.
>>>
>>> Aww jesus, completely missed it !
>>
>> So that was just to check permission:
>>
>> ==
>> http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46
>>
>> From the Loganaden Velvindron:
>>  Make dired more sane (and emacslike):
>>  *  Position cursor at first filename after ..
>>  *  Don't reposition cursor on reopening
>>  *  Check for permission before attempting to open directory
>>
>> I took forever to get this in. Thanks, Logan for being patient!
>> ==
>>
>> That should be an access(2) call.
>>
>
> or stat(2) due to tctu.

I believe in that case it would be the same, since there is still a
window between stat(2)/access(2) and open(2).

Reply via email to