[GRASS-dev] libgis: ERROR: Unable to make mapset element cell_misc/...

Markus Neteler neteler at osgeo.org
Sat Mar 7 02:09:39 EST 2009


On Sat, Mar 7, 2009 at 8:01 AM, Markus Neteler <neteler at osgeo.org> wrote:
> On Sat, Mar 7, 2009 at 6:34 AM, Glynn Clements <glynn at gclements.plus.com> wrote:
>> Markus Neteler wrote:
> ...
>> access() sets errno when it fails.
>>
>> If you want the reason why mkdir() failed, you need to test the return
>> value from G_mkdir(), e.g.:
>>
>>        if (access(path, 0) != 0)
>>            if (G_mkdir(path) != 0)
>>                G_fatal_error(_("Unable to make mapset element %s (%s): %s"),
>>                                p_element, path, strerror(errno));
>
> Ah thanks. I see now that access() is used twice:
> http://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/mapset_msc.c#L57
>
> I assume that I can remove the first try? see attached patch.
> Or is a second try to access unavoidable?

For that please consider attached patch.

Markus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mapset_msc_dualtest.diff
Type: application/octet-stream
Size: 921 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20090307/f67b9d9f/mapset_msc_dualtest-0001.obj


More information about the grass-dev mailing list