From a62a213bf0ec0c03cf8ba72b4d91fedced21f9a2 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Tue, 7 Nov 2006 17:29:48 +0000 Subject: * unix/tclUnixFCmd.c (CopyFile): [SF Tcl Bug 1586470]. Added code to fall back to a hardwired default block size should the filesystem report a bogus value. --- ChangeLog | 6 ++++++ unix/tclUnixFCmd.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24caa04..09064bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-11-07 Andreas Kupries + + * unix/tclUnixFCmd.c (CopyFile): [SF Tcl Bug 1586470]. Added code + to fall back to a hardwired default block size should the + filesystem report a bogus value. + 2006-11-04 Don Porter * generic/tclStringObj.c: Changed Tcl_ObjPrintf() response to diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index caadf68..8bf268d 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFCmd.c,v 1.58 2006/11/02 15:58:09 dgp Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.59 2006/11/07 17:29:48 andreas_kupries Exp $ * * Portions of this code were derived from NetBSD source code which has the * following copyright notice: @@ -541,6 +541,16 @@ TclUnixCopyFile( #endif #endif + /* [SF Tcl Bug 1586470] Even if we HAVE_ST_BLKSIZE, there are + * filesystems which report a bogus value for the blocksize. An + * example is the Andrew Filesystem (afs), reporting a blocksize + * of 0. When detecting such a situation we now simply fall back + * to a hardwired default size. + */ + + if (blockSize <= 0) { + blockSize = 4096; + } buffer = ckalloc(blockSize); while (1) { nread = (size_t) read(srcFd, buffer, blockSize); -- cgit v0.12