From d101da235bebfedc773e2f1be824df926891cc1a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 16 May 2005 18:45:19 +0000 Subject: r6822: Use chsize if we don't have ftruncate. From Steven Edwards . Jeremy. (This used to be commit 2f78ba5ea71504c2c9bb44c36000b3cab1227f78) --- source3/lib/replace.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/replace.c b/source3/lib/replace.c index 298707727e..b7695bd8dd 100644 --- a/source3/lib/replace.c +++ b/source3/lib/replace.c @@ -29,17 +29,20 @@ ftruncate for operating systems that don't have it ********************************************************************/ int ftruncate(int f,SMB_OFF_T l) { - struct flock fl; - - fl.l_whence = 0; - fl.l_len = 0; - fl.l_start = l; - fl.l_type = F_WRLCK; - return fcntl(f, F_FREESP, &fl); +#ifdef HAVE_CHSIZE + return chsize(f,l); +#else + struct flock fl; + + fl.l_whence = 0; + fl.l_len = 0; + fl.l_start = l; + fl.l_type = F_WRLCK; + return fcntl(f, F_FREESP, &fl); +#endif } #endif /* HAVE_FTRUNCATE */ - #ifndef HAVE_STRLCPY /* like strncpy but does not 0 fill the buffer and always null terminates. bufsize is the size of the destination buffer */ -- cgit