From b2c92b88cc6ce6d81444667efbc6d44542db1788 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Tue, 7 Jun 2016 04:31:48 -0500 Subject: fstabinfo/mountinfo: ensure /etc/fstab exists before calling setmntent This is based on a patch by A. Wilcox . X-Gentoo-Bug: 478226 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226 X-Gentoo-Bug: 478226 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226 --- src/rc/mountinfo.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rc/mountinfo.c') diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 10e3238d..29eb1600 100644 --- a/src/rc/mountinfo.c +++ b/src/rc/mountinfo.c @@ -297,6 +297,9 @@ getmntfile(const char *file) struct mntent *ent = NULL; FILE *fp; + if (!exists("/etc/fstab")) + return NULL; + fp = setmntent("/etc/fstab", "r"); while ((ent = getmntent(fp))) if (strcmp(file, ent->mnt_dir) == 0) -- cgit v1.2.3