[GRASS-dev] [GRASS GIS] #2278: G__tempfile() lacks perror support
GRASS GIS
trac at osgeo.org
Mon May 12 16:03:19 PDT 2014
#2278: G__tempfile() lacks perror support
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: LibGIS | Version: svn-releasebranch70
Keywords: r.hants | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
Replying to [comment:4 neteler]:
> > Ideally, strerror() (or similar) should be used, and the string
included in
> > the error message.
>
> Done by mmetz in r60148 and related.
For robustness, errno should be copied to a local variable immediately
after the failed call, e.g.:
{{{
fcb->null_fd = creat(tempname, 0666);
if (fcb->null_fd < 0) {
int err = errno;
...
G_fatal_error(_("No temp files available: %s"), strerror(err));
}
}}}
Otherwise, it may be modified by an intervening call (specifically,
close() can modify errno).
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2278#comment:5>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list