diff options
author | Karel Zak | 2011-03-31 21:26:57 +0200 |
---|---|---|
committer | Karel Zak | 2011-03-31 21:26:57 +0200 |
commit | a362ae601a4f047d56fc8487155733309da5a7ec (patch) | |
tree | 43cb2e779a382f7634d936d61dc1edefc06bdb55 /shlibs/mount/src/utils.c | |
parent | tests: add dump from PPC64 to lscpu tests (diff) | |
download | kernel-qcow2-util-linux-a362ae601a4f047d56fc8487155733309da5a7ec.tar.gz kernel-qcow2-util-linux-a362ae601a4f047d56fc8487155733309da5a7ec.tar.xz kernel-qcow2-util-linux-a362ae601a4f047d56fc8487155733309da5a7ec.zip |
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 <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/utils.c')
-rw-r--r-- | shlibs/mount/src/utils.c | 16 |
1 files changed, 12 insertions, 4 deletions
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; } |