Blob Blame History Raw
autofs-5.1.2 - fix _strncmp() usage

From: Ian Kent <raven@themaw.net>

A change to fix nfs mount options changed to using a custom strncmp()
function.

While the usage of the function is correct in the nfs and bind mount
modules it isn't correct in the autofs and ext2 mount modules.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG              |    1 +
 modules/mount_autofs.c |   12 ++++++------
 modules/mount_ext2.c   |    2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -221,6 +221,7 @@
 - fix short memory allocation in lookup_amd_instance().
 - fix count_mounts() function.
 - fix argc off by one in mount_autofs.c.
+- fix _strncmp() usage.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/mount_autofs.c
+++ autofs-5.0.7/modules/mount_autofs.c
@@ -121,17 +121,17 @@ int mount_mount(struct autofs_point *ap,
 			while (*comma != '\0' && *comma != ',')
 				comma++;
 
-			if (_strncmp(cp, "nobrowse", 8) == 0)
+			if (_strncmp("nobrowse", cp, 8) == 0)
 				ghost = 0;
-			else if (_strncmp(cp, "nobind", 6) == 0)
+			else if (_strncmp("nobind", cp, 6) == 0)
 				nobind = 1;
-			else if (_strncmp(cp, "browse", 6) == 0)
+			else if (_strncmp("browse", cp, 6) == 0)
 				ghost = 1;
-			else if (_strncmp(cp, "symlink", 7) == 0)
+			else if (_strncmp("symlink", cp, 7) == 0)
 				symlnk = 1;
-			else if (_strncmp(cp, "hosts", 5) == 0)
+			else if (_strncmp("hosts", cp, 5) == 0)
 				hosts = 1;
-			else if (_strncmp(cp, "timeout=", 8) == 0) {
+			else if (_strncmp("timeout=", cp, 8) == 0) {
 				char *val = strchr(cp, '=');
 				unsigned tout;
 				if (val) {
--- autofs-5.0.7.orig/modules/mount_ext2.c
+++ autofs-5.0.7/modules/mount_ext2.c
@@ -82,7 +82,7 @@ int mount_mount(struct autofs_point *ap,
 
 	if (options && options[0]) {
 		for (p = options; (p1 = strchr(p, ',')); p = p1)
-			if (!_strncmp(p, "ro", p1 - p) && ++p1 - p == sizeof("ro"))
+			if (!_strncmp("ro", p, p1 - p) && ++p1 - p == sizeof("ro"))
 				ro = 1;
 		if (!strcmp(p, "ro"))
 			ro = 1;