[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tempname: new try_tempname function
From: |
Andreas Grünbacher |
Subject: |
Re: [PATCH] tempname: new try_tempname function |
Date: |
Tue, 3 Feb 2015 00:24:17 +0100 |
Paul,
2015-02-02 23:37 GMT+01:00 Paul Eggert <address@hidden>:
> On 01/31/2015 02:49 PM, Andreas Gruenbacher wrote:
>>
>> +static int
>> +try_file (char *tmpl, void *flags)
>> +{
>> + return __open (tmpl,
>> + (* (int *) flags & ~O_ACCMODE)
>> + | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
>> +}
>
>
> Please avoid the cast by changing the body to look like this:
>
> int *openflags = flags;
> return __open (tmpl, (*openflags & ~O_ACCMODE) | ...
Okay.
>> + /* Give up now. */
>
> This comment no longer seems to make sense (the loop is now far away) and
> I'd remove it.
Okay.
>> + errno = EEXIST;
>
> The code previously used __set_errno to set errno; shouldn't it still do
> that?
Okay.
I've also simplified try_nocreate() slightly.
New version attached.
Thanks,
Andreas
0001-tempname-new-try_tempname-function.patch
Description: Text Data