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?
It should be safe to remove the second access() call, but I would be inclined to leave it. Checking that the directory actually exists is more robust than assuming that it will from the fact that G_mkdir() succeeded. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev