autofs-5.1.8 - get rid of strlen call in handle_packet_missing_direct() From: Ian Kent There is a length field in struct mapent, use it. Signed-off-by: Ian Kent --- CHANGELOG | 1 + daemon/direct.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c508883d..97dc4aba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -79,6 +79,7 @@ - eliminate realpath from mount of submount. - eliminate root param from autofs mount and umount. - remove redundant fstat from do_mount_direct(). +- get rid of strlen call in handle_packet_missing_direct(). 19/10/2021 autofs-5.1.8 - add xdr_exports(). diff --git a/daemon/direct.c b/daemon/direct.c index 6de45f8d..99be4ef2 100644 --- a/daemon/direct.c +++ b/daemon/direct.c @@ -1294,7 +1294,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ char buf[MAX_ERR_BUF]; int status = 0; struct timespec wait; - int ioctlfd, len, state; + int ioctlfd, state; unsigned int kver_major = get_kver_major(); unsigned int kver_minor = get_kver_minor(); @@ -1396,8 +1396,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ return 0; } - len = strlen(me->key); - if (len >= PATH_MAX) { + if (me->len >= PATH_MAX) { error(ap->logopt, "direct mount path too long %s", me->key); ops->send_fail(ap->logopt, ioctlfd, pkt->wait_queue_token, -ENAMETOOLONG); @@ -1436,7 +1435,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ mt->ioctlfd = ioctlfd; mt->mc = mc; strcpy(mt->name, me->key); - mt->len = len; + mt->len = me->len; mt->dev = me->dev; mt->type = NFY_MOUNT; mt->uid = pkt->uid;