From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 5935413829C for ; Fri, 10 Jun 2016 22:45:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C1DC3141A2; Fri, 10 Jun 2016 22:45:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6AA56141A2 for ; Fri, 10 Jun 2016 22:45:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5950A340ADB for ; Fri, 10 Jun 2016 22:45:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3796813FE for ; Fri, 10 Jun 2016 22:45:26 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1465596997.b2c92b88cc6ce6d81444667efbc6d44542db1788.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/fstabinfo.c src/rc/mountinfo.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: b2c92b88cc6ce6d81444667efbc6d44542db1788 X-VCS-Branch: master Date: Fri, 10 Jun 2016 22:45:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f7feb373-ec4d-419a-b05b-b7abab4a885a X-Archives-Hash: de0ce5aa8110c3d9dc0b018bece8003d commit: b2c92b88cc6ce6d81444667efbc6d44542db1788 Author: William Hubbs gmail com> AuthorDate: Tue Jun 7 09:31:48 2016 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Jun 10 22:16:37 2016 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b2c92b88 fstabinfo/mountinfo: ensure /etc/fstab exists before calling setmntent This is based on a patch by A. Wilcox foxkit.us>. 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/fstabinfo.c | 3 +++ src/rc/mountinfo.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/rc/fstabinfo.c b/src/rc/fstabinfo.c index bd2372d..75c8bc2 100644 --- a/src/rc/fstabinfo.c +++ b/src/rc/fstabinfo.c @@ -178,6 +178,9 @@ int main(int argc, char **argv) FILE *fp; #endif + /* fail if there is no /etc/fstab */ + if (!exists("/etc/fstab")) + eerrorx("/etc/fstab does not exist"); /* Ensure that we are only quiet when explicitly told to be */ unsetenv("EINFO_QUIET"); diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 10e3238..29eb160 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)