commit:     b73941f0c3020e3dbd1684d09685e114c678b520
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Jan  5 00:18:27 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jan  5 00:18:37 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b73941f0

mountinfo: make the path to /proc/mounts a constant

This path should not be hard coded in the open call.
Linux prior to 2.4.19 did not have /proc/self/mounts, so for now I'm
making this value /proc/mounts everywhere, but that may change to
/proc/self/mounts on linux; I'm not sure we should care about <2.4.19.

X-Gentoo-Bug: 604646
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604646

 src/rc/mountinfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c
index 29eb160..d9c25a3 100644
--- a/src/rc/mountinfo.c
+++ b/src/rc/mountinfo.c
@@ -46,6 +46,7 @@
 #include "_usage.h"
 
 const char *applet = NULL;
+const char *procmounts = "/proc/mounts";
 const char *extraopts = "[mount1] [mount2] ...";
 const char *getoptstring = "f:F:n:N:o:O:p:P:iste:E:" getoptstring_COMMON;
 const struct option longopts[] = {
@@ -323,7 +324,7 @@ find_mounts(struct args *args)
        int netdev;
        RC_STRINGLIST *list;
 
-       if ((fp = fopen("/proc/self/mounts", "r")) == NULL)
+       if ((fp = fopen(procmounts, "r")) == NULL)
                eerrorx("getmntinfo: %s", strerror(errno));
 
        list = rc_stringlist_new();

Reply via email to