[PATCH] Don't fail to create passwd and group files if /etc already exists

Chris Johns chrisj at rtems.org
Sat Feb 21 20:34:09 UTC 2015


On 20/02/2015 11:00 pm, Sebastian Huber wrote:
>
> On 20/02/15 12:18, Chris Johns wrote:
>> On 20/02/2015 8:29 pm, Sebastian Huber wrote:
>>>
>>> On 20/02/15 10:06, Nick Withers wrote:
>>>> On Fri, 2015-02-20 at 08:59 +0100, Sebastian Huber wrote:
>>>>> >Hello Nick,
>>>>> >
>>>>> >thanks for the patch. I checked in a slightly different version which
>>>>> >ignores the return status completely.
>>>> Hi Sebastian,
>>>>
>>>> Your commit effectively reverts Joel's changes in
>>>> https://git.rtems.org/rtems/commit/?id=3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade
>>>>
>>>>
>>>>
>>>> Would chucking a (void) in front of the mkdir() shut Coverity up?
>>>
>>> Ok, I should have checked the commit history since I wondered why I
>>> added this error check in the first place. Lets try a (void) cast.
>>>
>>
>> What about doing a stat, create the directory if not present and then
>> error on a mkdir failure ? There are other failures that could happen
>> making a directory that we should correctly report.
>
> The stat approach is not thread safe.
>
> Its up to the users of the create files to do the error handling.
>

Maybe just check the error code for EEXIST and ignore it, plus the call 
is protected by a posix init once variable so I am not sure I follow 
this thread safe bit.

Chris



More information about the devel mailing list