diff mbox

[linux-cifs-client,06/10] mount.cifs: make check_mountpoint a noop for non-legacy builds

Message ID 1269199227-21446-7-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton March 21, 2010, 7:20 p.m. UTC
None
diff mbox

Patch

diff --git a/mount.cifs.c b/mount.cifs.c
index 84167f3..4631310 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -115,31 +115,10 @@  char * domain_name = NULL;
 char * prefixpath = NULL;
 const char *cifs_fstype = "cifs";
 
-/*
- * If an unprivileged user is doing the mounting then we need to ensure
- * that the entry is in /etc/fstab.
- */
+#if CIFS_LEGACY_SETUID_CHECK
 static int
 check_mountpoint(const char *progname, char *mountpoint)
 {
-	int err;
-	struct stat statbuf;
-
-	/* does mountpoint exist and is it a directory? */
-	err = stat(".", &statbuf);
-	if (err) {
-		fprintf(stderr, "%s: failed to stat %s: %s\n", progname,
-				mountpoint, strerror(errno));
-		return EX_USAGE;
-	}
-
-	if (!S_ISDIR(statbuf.st_mode)) {
-		fprintf(stderr, "%s: %s is not a directory!", progname,
-				mountpoint);
-		return EX_USAGE;
-	}
-
-#if CIFS_LEGACY_SETUID_CHECK
 	/* do extra checks on mountpoint for legacy setuid behavior */
 	if (!getuid() || geteuid())
 		return 0;
@@ -155,10 +134,16 @@  check_mountpoint(const char *progname, char *mountpoint)
 			mountpoint);
 		return EX_USAGE;
 	}
-#endif /* CIFS_LEGACY_SETUID_CHECK */
 
 	return 0;
 }
+#else /* CIFS_LEGACY_SETUID_CHECK */
+static int
+check_mountpoint(const char *progname, char *mountpoint)
+{
+	return 0;
+}
+#endif /* CIFS_LEGACY_SETUID_CHECK */
 
 #if CIFS_DISABLE_SETUID_CHECK
 static int