summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/rewrite.m42
-rw-r--r--source4/lib/replace.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4
index 0da7316f5a..6917138ba2 100644
--- a/source4/build/m4/rewrite.m4
+++ b/source4/build/m4/rewrite.m4
@@ -192,7 +192,7 @@ AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy st
AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf realpath)
-AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate)
+AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate chsize)
AC_CHECK_FUNCS(setluid getpwanam setlinebuf)
AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm backtrace)
diff --git a/source4/lib/replace.c b/source4/lib/replace.c
index ca367da9b5..89612912b7 100644
--- a/source4/lib/replace.c
+++ b/source4/lib/replace.c
@@ -32,6 +32,9 @@ ftruncate for operating systems that don't have it
********************************************************************/
int ftruncate(int f,off_t l)
{
+#ifdef HAVE_CHSIZE
+ return chsize(f,l);
+#else
struct flock fl;
fl.l_whence = 0;
@@ -39,6 +42,7 @@ ftruncate for operating systems that don't have it
fl.l_start = l;
fl.l_type = F_WRLCK;
return fcntl(f, F_FREESP, &fl);
+#endif
}
#endif /* HAVE_FTRUNCATE */