summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/utils.c
diff options
context:
space:
mode:
authorKarel Zak2010-08-05 12:35:54 +0200
committerKarel Zak2011-01-03 12:28:40 +0100
commitbe1a5180596aa3a413e9c8047d0d25f4704756ef (patch)
tree747ea4dc2ee4176084ae076a815381bdd293ff72 /shlibs/mount/src/utils.c
parentfindmnt: add support for fs-root (subvolumes and bind mounts) (diff)
downloadkernel-qcow2-util-linux-be1a5180596aa3a413e9c8047d0d25f4704756ef.tar.gz
kernel-qcow2-util-linux-be1a5180596aa3a413e9c8047d0d25f4704756ef.tar.xz
kernel-qcow2-util-linux-be1a5180596aa3a413e9c8047d0d25f4704756ef.zip
libmount: correctly use "none" values
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/utils.c')
-rw-r--r--shlibs/mount/src/utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c
index 55e060581..15785df2a 100644
--- a/shlibs/mount/src/utils.c
+++ b/shlibs/mount/src/utils.c
@@ -325,8 +325,10 @@ int mnt_has_regular_mtab(void)
/**
* mnt_get_writable_mtab_path:
*
- * Returns: pointer to the static string with path to the file with userspace
- * mount options (classic /etc/mtab or /var/run/mount/mountinfo)
+ * It's not error if this function return NULL and errno is not set. In case of
+ * error the errno is set by open(2).
+ *
+ * Returns: pointer to the static string with path to mtab or NULL.
*/
const char *mnt_get_writable_mtab_path(void)
{
@@ -336,6 +338,8 @@ const char *mnt_get_writable_mtab_path(void)
mtab = !lstat(_PATH_MOUNTED, &mst);
info = !stat(MNT_PATH_RUNDIR, &ist);
+ errno = 0;
+
/* A) mtab is symlink, /var/run/mount is available */
if (mtab && S_ISLNK(mst.st_mode) && info) {
int fd = open(MNT_PATH_MOUNTINFO, O_RDWR | O_CREAT, 0644);