diff options
Diffstat (limited to 'libmount/src')
-rw-r--r-- | libmount/src/context.c | 3 | ||||
-rw-r--r-- | libmount/src/context_mount.c | 5 | ||||
-rw-r--r-- | libmount/src/context_umount.c | 4 | ||||
-rw-r--r-- | libmount/src/fs.c | 2 | ||||
-rw-r--r-- | libmount/src/tab_update.c | 6 |
5 files changed, 12 insertions, 8 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index 952287a..5206c1d 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -367,8 +367,7 @@ const char *mnt_context_get_writable_tabpath(struct libmnt_context *cxt) { assert(cxt); - context_init_paths(cxt, 1); - return cxt->utab_path; + return mnt_context_utab_writable(cxt) ? cxt->utab_path : NULL; } diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 478a9fd..f9d610f 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -546,9 +546,10 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type) cxt->syscall_status = 0; } - if (org_type && rc != 0) + if (org_type && rc != 0) { __mnt_fs_set_fstype_ptr(cxt->fs, org_type); - org_type = NULL; + org_type = NULL; + } if (rc == 0 && try_type && cxt->update) { struct libmnt_fs *fs = mnt_update_get_fs(cxt->update); diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 79b6237..bf70ed2 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -267,6 +267,9 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg * So, let's use statfs() if possible (it's bad idea for --lazy/--force * umounts as target is probably unreachable NFS, also for --detach-loop * as this additionally needs to know the name of the loop device). + * + * For the "umount --read-only" command, we need to read the mountinfo + * to obtain the mount source. */ if (mnt_context_is_restricted(cxt) || *tgt != '/' @@ -275,6 +278,7 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg || mnt_context_is_lazy(cxt) || mnt_context_is_nocanonicalize(cxt) || mnt_context_is_loopdel(cxt) + || mnt_context_is_rdonly_umount(cxt) || mnt_safe_stat(tgt, &st) != 0 || !S_ISDIR(st.st_mode) || has_utab_entry(cxt, tgt)) return 1; /* not found */ diff --git a/libmount/src/fs.c b/libmount/src/fs.c index 79e32a1..26f2c69 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -1454,7 +1454,7 @@ int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name, * mnt_fs_get_comment: * @fs: fstab/mtab/mountinfo entry pointer * - * Returns: 0 on success, 1 when not found the @name or negative number in case of error. + * Returns: comment string */ const char *mnt_fs_get_comment(struct libmnt_fs *fs) { diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c index 87512af..d44d190 100644 --- a/libmount/src/tab_update.c +++ b/libmount/src/tab_update.c @@ -982,9 +982,9 @@ int mnt_update_already_done(struct libmnt_update *upd) if (mnt_optstr_get_missing(fs->user_optstr, upd->fs->user_optstr, NULL) == 0) { upd->missing_options = 1; DBG(UPDATE, ul_debugobj(upd, " missing options detected")); - } - } else - rc = 1; + } else + rc = 1; + } } else if (upd->target) { /* umount */ |