autofs-5.1.2 - fix _strncmp() usage From: Ian Kent 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 --- CHANGELOG | 1 + modules/mount_autofs.c | 12 ++++++------ modules/mount_ext2.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3c9ee80..3fb933b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,7 @@ xx/xx/2016 autofs-5.1.3 - fix typo in MOUNT_FLAG_GHOST comment. - fix cachefs parse message not being logged. - fix argc off by one in mount_autofs.c. +- fix _strncmp() usage. 15/06/2016 autofs-5.1.2 ======================= diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c index 65c0a06..0476a09 100644 --- a/modules/mount_autofs.c +++ b/modules/mount_autofs.c @@ -121,17 +121,17 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, 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) { diff --git a/modules/mount_ext2.c b/modules/mount_ext2.c index c00e3d5..90fc087 100644 --- a/modules/mount_ext2.c +++ b/modules/mount_ext2.c @@ -82,7 +82,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int 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;