use strerror() for open error messages on unix (#2341)

This commit is contained in:
Frank Warmerdam 2012-06-01 21:40:58 +00:00
parent f8fcbec59d
commit ecf4fed966
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2012-06-01 Frank Warmerdam <warmerdam@google.com> 2012-06-01 Frank Warmerdam <warmerdam@google.com>
* libtiff/tif_unix.c: use strerror() to return a more specific error message
on failed open.
http://bugzilla.maptools.org/show_bug.cgi?id=2341
* libtiff/tif_jpeg.c: Fix JPEGDecodeRaw() bugs. * libtiff/tif_jpeg.c: Fix JPEGDecodeRaw() bugs.
http://bugzilla.maptools.org/show_bug.cgi?id=2386 http://bugzilla.maptools.org/show_bug.cgi?id=2386

View File

@ -1,4 +1,4 @@
/* $Id: tif_unix.c,v 1.22 2010-03-10 18:56:49 bfriesen Exp $ */ /* $Id: tif_unix.c,v 1.23 2012-06-01 21:40:59 fwarmerdam Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -186,7 +186,11 @@ TIFFOpen(const char* name, const char* mode)
fd = open(name, m, 0666); fd = open(name, m, 0666);
if (fd < 0) { if (fd < 0) {
if (errno > 0 && strerror(errno) != NULL ) {
TIFFErrorExt(0, module, "%s: %s", name, strerror(errno) );
} else {
TIFFErrorExt(0, module, "%s: Cannot open", name); TIFFErrorExt(0, module, "%s: Cannot open", name);
}
return ((TIFF *)0); return ((TIFF *)0);
} }