From ecf4fed9665fcc7e3d5f45e3a7f18412fd2e9415 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Fri, 1 Jun 2012 21:40:58 +0000 Subject: [PATCH] use strerror() for open error messages on unix (#2341) --- ChangeLog | 4 ++++ libtiff/tif_unix.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59e99040..f36d7574 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-06-01 Frank Warmerdam + * 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. http://bugzilla.maptools.org/show_bug.cgi?id=2386 diff --git a/libtiff/tif_unix.c b/libtiff/tif_unix.c index 7c5cc50f..1387558f 100644 --- a/libtiff/tif_unix.c +++ b/libtiff/tif_unix.c @@ -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 @@ -186,7 +186,11 @@ TIFFOpen(const char* name, const char* mode) fd = open(name, m, 0666); if (fd < 0) { - TIFFErrorExt(0, module, "%s: Cannot open", name); + if (errno > 0 && strerror(errno) != NULL ) { + TIFFErrorExt(0, module, "%s: %s", name, strerror(errno) ); + } else { + TIFFErrorExt(0, module, "%s: Cannot open", name); + } return ((TIFF *)0); }