--- a/src/client.c	2009-07-03 13:08:33.000000000 +1000
+++ b/src/client.c	2009-07-03 13:20:40.000000000 +1000
@@ -414,9 +414,9 @@ static int sendfile(rname, opts, stb, us
 	/*
 	 * Send file info
 	 */
-	(void) sendcmd(C_RECVREG, "%o %04o %ld %ld %ld %s %s %s", 
+	(void) sendcmd(C_RECVREG, "%o %04o %lld %ld %ld %s %s %s", 
 		       opts, stb->st_mode & 07777, 
-		       (long) stb->st_size, 
+		       (off_t) stb->st_size, 
 		       stb->st_mtime, stb->st_atime,
 		       user, group, rname);
 	if (response() < 0) {
@@ -424,8 +424,8 @@ static int sendfile(rname, opts, stb, us
 		return(-1);
 	}
 
-	debugmsg(DM_MISC, "Send file '%s' %d bytes\n", 
-		 rname, (long) stb->st_size);
+	debugmsg(DM_MISC, "Send file '%s' %lld bytes\n", 
+		 rname, (off_t) stb->st_size);
 
 	/*
 	 * Set remote time out alarm handler.
@@ -676,9 +676,9 @@ static int sendlink(rname, opts, stb, us
 	/*
 	 * Gather and send basic link info
 	 */
-	(void) sendcmd(C_RECVSYMLINK, "%o %04o %ld %ld %ld %s %s %s", 
+	(void) sendcmd(C_RECVSYMLINK, "%o %04o %lld %ld %ld %s %s %s", 
 		       opts, stb->st_mode & 07777, 
-		       (long) stb->st_size, 
+		       (off_t) stb->st_size, 
 		       stb->st_mtime, stb->st_atime,
 		       user, group, rname);
 	if (response() < 0)
@@ -858,7 +858,7 @@ static int update(rname, opts, statp)
 	/*
 	 * Parse size
 	 */
-	size = strtol(cp, &cp, 10);
+	size = strtoll(cp, &cp, 10);
 	if (*cp++ != ' ') {
 		error("update: size not delimited");
 		return(US_NOTHING);
@@ -910,8 +910,8 @@ static int update(rname, opts, statp)
 
 	debugmsg(DM_MISC, "update(%s,) local mode %04o remote mode %04o\n", 
 		 rname, lmode, rmode);
-	debugmsg(DM_MISC, "update(%s,) size %d mtime %d owner '%s' grp '%s'\n",
-		 rname, (int) size, mtime, owner, group);
+	debugmsg(DM_MISC, "update(%s,) size %lld mtime %d owner '%s' grp '%s'\n",
+		 rname, (off_t) size, mtime, owner, group);
 
 	if (statp->st_mtime != mtime) {
 		if (statp->st_mtime < mtime && IS_ON(opts, DO_YOUNGER)) {
@@ -937,8 +937,8 @@ static int update(rname, opts, statp)
 	}
 
 	if (statp->st_size != size) {
-		debugmsg(DM_MISC, "size does not match (%d != %d).\n",
-			 (int) statp->st_size, size);
+		debugmsg(DM_MISC, "size does not match (%lld != %lld).\n",
+			 statp->st_size, size);
 		return(US_OUTDATE);
 	} 
 
--- a/src/server.c	2009-07-03 13:08:33.000000000 +1000
+++ b/src/server.c	2009-07-03 13:20:40.000000000 +1000
@@ -645,8 +645,8 @@ static void query(name)
 	case S_IFLNK:
 	case S_IFDIR:
 	case S_IFREG:
-		(void) sendcmd(QC_YES, "%ld %ld %o %s %s",
-			       (long) stb.st_size, 
+		(void) sendcmd(QC_YES, "%lld %ld %o %s %s",
+			       (off_t) stb.st_size, 
 			       stb.st_mtime, 
 			       stb.st_mode & 07777,
 			       getusername(stb.st_uid, target, options), 
@@ -1387,7 +1387,7 @@ static void recvit(cmd, type)
 	/*
 	 * Get file size
 	 */
-	size = strtol(cp, &cp, 10);
+	size = strtoll(cp, &cp, 10);
 	if (*cp++ != ' ') {
 		error("recvit: size not delimited");
 		return;
@@ -1440,7 +1440,7 @@ static void recvit(cmd, type)
 	}
 
 	debugmsg(DM_MISC,
-		 "recvit: opts = %04o mode = %04o size = %d mtime = %d",
+		 "recvit: opts = %04o mode = %04o size = %lld mtime = %d",
 		 opts, mode, size, mtime);
 	debugmsg(DM_MISC,
        "recvit: owner = '%s' group = '%s' file = '%s' catname = %d isdir = %d",
--- a/include/defs.h	2009-07-03 13:08:33.000000000 +1000
+++ b/include/defs.h	2009-07-03 13:20:40.000000000 +1000
@@ -22,6 +22,8 @@
 #endif	/* _POSIX_SOURCE */
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
+#include <mntent.h>
 #include <ctype.h>
 #include <errno.h>
 #include <pwd.h>
--- a/config/mf.linux	1998-11-10 12:53:01.000000000 +0900
+++ b/config/mf.linux	2012-04-27 00:00:00.000000000 +0900
@@ -26,7 +26,7 @@
 #
 # System dependent options for compiling
 #
-#CFLAGS_OS	=
+CFLAGS_OS	= -O2 -g -pipe -Wall -D_POSIX_SOURCE -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
 BIN_DIR		= /usr/bin
 
