From 0c9f0357bf160e920e103c027c75058e42bcf22a Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 7 Jun 2016 04:31:48 -0500 Subject: [PATCH] Ensure /etc/fstab exists before calling setmntent X-Gentoo-Bug: 478226 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226 Signed-Off-By: A. Wilcox --- src/rc/mountinfo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 10e3238..d6d3ae2 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 ((access("/etc/fstab", F_OK)) == -1) + return NULL; + fp = setmntent("/etc/fstab", "r"); while ((ent = getmntent(fp))) if (strcmp(file, ent->mnt_dir) == 0) -- 2.8.3