From: ellcs Date: Sun, 13 Mar 2022 15:56:54 +0000 (+0100) Subject: Fix crash, when mount was not found on bsd systems X-Git-Tag: v2.38-rc3~14^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a479160141bc121ebd5edf67fd406e5b2fe6630;p=thirdparty%2Futil-linux.git Fix crash, when mount was not found on bsd systems --- 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