From 4a479160141bc121ebd5edf67fd406e5b2fe6630 Mon Sep 17 00:00:00 2001 From: ellcs Date: Sun, 13 Mar 2022 16:56:54 +0100 Subject: [PATCH] Fix crash, when mount was not found on bsd systems --- lib/ismounted.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ismounted.c b/lib/ismounted.c index 565a832593..31be71a435 100644 --- a/lib/ismounted.c +++ b/lib/ismounted.c @@ -242,7 +242,7 @@ static int check_getmntinfo(const char *file, int *mount_flags, } ++mp; } - if (mtpt) + if (mtpt && n >= 0) xstrncpy(mtpt, mp->f_mntonname, mtlen); return 0; } @@ -305,7 +305,7 @@ leave: /* - * check_mount_point() fills determines if the device is mounted or otherwise + * check_mount_point() determines if the device is mounted or otherwise * busy, and fills in mount_flags with one or more of the following flags: * MF_MOUNTED, MF_ISROOT, MF_READONLY, MF_SWAP, and MF_BUSY. If mtpt is * non-NULL, the directory where the device is mounted is copied to where mtpt -- 2.47.2