summaryrefslogtreecommitdiffstats
path: root/source/lib/replace.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-05-16 18:45:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:55 -0500
commit2f78ba5ea71504c2c9bb44c36000b3cab1227f78 (patch)
tree5018167b4b24fc27e86f63ff8c6c980c372aaca0 /source/lib/replace.c
parent2529d615a6fcd09e494b445ee7a4acec78005ac2 (diff)
downloadsamba-2f78ba5ea71504c2c9bb44c36000b3cab1227f78.tar.gz
samba-2f78ba5ea71504c2c9bb44c36000b3cab1227f78.tar.xz
samba-2f78ba5ea71504c2c9bb44c36000b3cab1227f78.zip
r6822: Use chsize if we don't have ftruncate. From Steven Edwards <steven_ed4153@yahoo.com>.
Jeremy.
Diffstat (limited to 'source/lib/replace.c')
-rw-r--r--source/lib/replace.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/lib/replace.c b/source/lib/replace.c
index 298707727e9..b7695bd8dd0 100644
--- a/source/lib/replace.c
+++ b/source/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 */