From a362ae601a4f047d56fc8487155733309da5a7ec Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 31 Mar 2011 21:26:57 +0200 Subject: libmount: support /run/mount rather than /dev/.mount The /run directory should be preferred on distributions where this directory exists. http://thread.gmane.org/gmane.linux.redhat.fedora.devel/146976 Signed-off-by: Karel Zak --- shlibs/mount/src/utils.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'shlibs/mount/src/utils.c') diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index 27832b36a..8f0e49c9b 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -600,9 +600,9 @@ done: * Don't export this to libmount API -- utab is private library stuff. * * If the file does not exist and @writable argument is not NULL then it will - * try to create the directory (e.g. /dev/.mount) and the file. + * try to create the directory (e.g. /run/mount) and the file. * - * Returns: 1 if /dev/.mount/utab is a regular file, and 0 in case of + * Returns: 1 if utab is a regular file, and 0 in case of * error (check errno for more details). */ int mnt_has_regular_utab(const char **utab, int *writable) @@ -682,12 +682,20 @@ const char *mnt_get_mtab_path(void) /* * Don't export this to libmount API -- utab is private library stuff. * - * Returns: path to /dev/.mount/utab or $LIBMOUNT_UTAB. + * Returns: path to /run/mount/utab (or /dev/.mount/utab) or $LIBMOUNT_UTAB. */ const char *mnt_get_utab_path(void) { + struct stat st; const char *p = safe_getenv("LIBMOUNT_UTAB"); - return p ? : MNT_PATH_UTAB; + + if (p) + return p; + + if (stat(MNT_RUNTIME_TOPDIR, &st) == 0) + return MNT_PATH_UTAB; + + return MNT_PATH_UTAB_OLD; } -- cgit v1.2.3-55-g7522