summaryrefslogtreecommitdiff
path: root/libtiff/tif_open.c
diff options
context:
space:
mode:
authorAndrey Kiselev <dron@ak4719.spb.edu>2005-03-30 13:49:13 +0000
committerAndrey Kiselev <dron@ak4719.spb.edu>2005-03-30 13:49:13 +0000
commit88321f931d0cc423eb13ee3d079c6c5202a1efc5 (patch)
treecb23369d670e2448119e7d114ccb400aa6ff0e51 /libtiff/tif_open.c
parentae711a78b0ff387412169146e89e5e6a2d618f65 (diff)
downloadlibtiff-git-88321f931d0cc423eb13ee3d079c6c5202a1efc5.tar.gz
Do not read header in case the output file should be truncated (Ron).
Diffstat (limited to 'libtiff/tif_open.c')
-rw-r--r--libtiff/tif_open.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libtiff/tif_open.c b/libtiff/tif_open.c
index 7214f2f6..c20a7660 100644
--- a/libtiff/tif_open.c
+++ b/libtiff/tif_open.c
@@ -1,4 +1,4 @@
-/* $Id: tif_open.c,v 1.23 2005-01-30 12:05:20 dron Exp $ */
+/* $Id: tif_open.c,v 1.24 2005-03-30 13:49:13 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -295,7 +295,8 @@ TIFFClientOpen(
/*
* Read in TIFF header.
*/
- if (!ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
+ if (tif->tif_mode & O_TRUNC ||
+ !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
if (tif->tif_mode == O_RDONLY) {
TIFFError(name, "Cannot read TIFF header");
goto bad;