Skip to contentSkip to conversation

nfs-utils 7 of 10 - Changed mountd to use stat64()

PATCH New Steve Dickson 1 participant 1 message Sep 23, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs-utils 7 of 10 - Changed mountd to use stat64()

Changed mountd to use stat64() (bz 165062)
Which fixed the following error:
rpc.mountd: can't stat exported dir /mnt/bigfile: Value too large for defined data type

I wonder if it would be better just to make mountd a 64bit application by compiling with -D_FILE_OFFSET_BITS=64?

Details can be found in:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=165062

---------

utils/mountd/mountd.c renamed from utils/mountd/mountd.c.orig +5 -5
@@ -187,7 +187,7 @@ mount_pathconf_2_svc(struct svc_req *rqs
 {
 	struct sockaddr_in *sin
 		= (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-	struct stat	stb;
+	struct stat64	stb;
 	nfs_export	*exp;
 	char		rpath[MAXPATHLEN+1];
 	char		*p = *path;
@@ -209,7 +209,7 @@ mount_pathconf_2_svc(struct svc_req *rqs
 	/* Now authenticate the intruder... */
 	if (!(exp = auth_authenticate("pathconf", sin, p))) {
 		return 1;
-	} else if (stat(p, &stb) < 0) {
+	} else if (stat64(p, &stb) < 0) {
 		xlog(L_WARNING, "can't stat exported dir %s: %s",
 				p, strerror(errno));
 		export_reset (exp);
@@ -263,7 +263,7 @@ get_rootfh(struct svc_req *rqstp, dirpat
 {
 	struct sockaddr_in *sin =
 		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-	struct stat	stb, estb;
+	struct stat64	stb, estb;
 	nfs_export	*exp;
 	char		rpath[MAXPATHLEN+1];
 	char		*p = *path;
@@ -283,7 +283,7 @@ get_rootfh(struct svc_req *rqstp, dirpat
 	/* Now authenticate the intruder... */
 	if (!(exp = auth_authenticate("mount", sin, p))) {
 		*error = NFSERR_ACCES;
-	} else if (stat(p, &stb) < 0) {
+	} else if (stat64(p, &stb) < 0) {
 		xlog(L_WARNING, "can't stat exported dir %s: %s",
 				p, strerror(errno));
 		if (errno == ENOENT)
@@ -293,7 +293,7 @@ get_rootfh(struct svc_req *rqstp, dirpat
 	} else if (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) {
 		xlog(L_WARNING, "%s is not a directory or regular file", p);
 		*error = NFSERR_NOTDIR;
-	} else if (stat(exp->m_export.e_path, &estb) < 0) {
+	} else if (stat64(exp->m_export.e_path, &estb) < 0) {
 		xlog(L_WARNING, "can't stat export point %s: %s",
 		     p, strerror(errno));
 		*error = NFSERR_NOENT;