summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/utils.c
diff options
context:
space:
mode:
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);