On 30 October 2012 16:52, Christiano F. Haesbaert
<haesba...@haesbaert.org> wrote:
> On 30 October 2012 16:45, Okan Demirmen <o...@demirmen.com> wrote:
>> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
>> <haesba...@haesbaert.org> wrote:
>>> On 30 October 2012 15:03, Christiano F. Haesbaert
>>> <haesba...@haesbaert.org> wrote:
>>>> On 30 October 2012 15:00, Mike Belopuhov <m...@belopuhov.com> wrote:
>>>>> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>>>>> <haesba...@haesbaert.org> wrote:
>>>>>> On 30 October 2012 14:36, rustyBSD <rusty...@gmx.fr> 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).

I mean, considering he would open/stat/close and open again.

Reply via email to