svn commit: samba r6824 - in trunk/source: . lib

jra at samba.org jra at samba.org
Mon May 16 18:53:18 GMT 2005


Author: jra
Date: 2005-05-16 18:53:17 +0000 (Mon, 16 May 2005)
New Revision: 6824

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6824

Log:
Use chsize if we don't have ftruncate. From Steven Edwards <steven_ed4153 at yahoo.com>.
Jeremy.

Modified:
   trunk/source/configure.in
   trunk/source/lib/replace.c


Changeset:
Modified: trunk/source/configure.in
===================================================================
--- trunk/source/configure.in	2005-05-16 18:51:59 UTC (rev 6823)
+++ trunk/source/configure.in	2005-05-16 18:53:17 UTC (rev 6824)
@@ -1027,7 +1027,7 @@
 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 poll rdchk getgrnam getgrent pathconf realpath)
-AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
+AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate chsize stat64 fstat64)
 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)

Modified: trunk/source/lib/replace.c
===================================================================
--- trunk/source/lib/replace.c	2005-05-16 18:51:59 UTC (rev 6823)
+++ trunk/source/lib/replace.c	2005-05-16 18:53:17 UTC (rev 6824)
@@ -29,17 +29,20 @@
 ********************************************************************/
  int ftruncate(int f,SMB_OFF_T l)
 {
-      struct  flock   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);
+	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 */



More information about the samba-cvs mailing list