diff options
author | Karel Zak <kzak@redhat.com> | 2013-02-26 14:17:42 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2013-02-26 14:17:42 +0100 |
commit | 2b90c471de604d63b40fff3769758adbb8077454 (patch) | |
tree | df2a752e90a01fbcfebbae85004920b7733f034b /libmount/src | |
parent | dad88cb3573fd204971365fed6f7797c4b355946 (diff) | |
download | util-linux-2b90c471de604d63b40fff3769758adbb8077454.tar.gz |
libmount: don't prepare update for empty mtab/utab on umount
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r-- | libmount/src/context.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index 2e2a161d..614d3f3b 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -1676,14 +1676,21 @@ int mnt_context_prepare_update(struct libmnt_context *cxt) cxt->syscall_status)); return 0; } + if (!cxt->update) { + const char *name = cxt->mtab_writable ? cxt->mtab_path : cxt->utab_path; + + if (cxt->action == MNT_ACT_UMOUNT && is_file_empty(name)) { + DBG(CXT, mnt_debug_h(cxt, + "skip update: umount, no table")); + return 0; + } + cxt->update = mnt_new_update(); if (!cxt->update) return -ENOMEM; - mnt_update_set_filename(cxt->update, - cxt->mtab_writable ? cxt->mtab_path : cxt->utab_path, - !cxt->mtab_writable); + mnt_update_set_filename(cxt->update, name, !cxt->mtab_writable); } if (cxt->action == MNT_ACT_UMOUNT) |