Torsten Bögershausen <[email protected]> writes:

> On 2014-10-27 13.10, Nguyễn Thái Ngọc Duy wrote:
> []
>
>> +static void xmkdir(const char *path)
>> +{
>> +    if (mkdir(path, 0700))
>> +            die_errno(_("failed to create directory %s"), path);
>> +}
>
> Does it makes sense to ignore EINTR and do a "retry" ?
> Another question is if the function could be called mkdir_or_die() instead?

Probably.  It is in the same league as xread() and xwrite().

> I realized that there are 2 families of xfunc() in wrapper.c, some die, some 
> retry.

The general idea of wrapper.c is to free callers from coding
something they have only one sensible choice for.  The ones that
retry such as xread() and xwrite() are to free callers from
diagnosing and retrying upon EAGAIN/EINTR because they want to read
or write and there is no other thing they want to do.  The ones that
die such as xmkstemp() are for the failure modes that are likely
without any other choice.  xcalloc() and other allocators started as
(and still are) the latter, but instead of immediately dying they
know a last-ditch effort that is common to all Git operations.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to