From: Karel Zak Date: Wed, 24 Aug 2022 15:10:37 +0000 (+0200) Subject: libmount: (context) ask for utab path only once X-Git-Tag: v2.39-rc1~285 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2454f70194d6399791c931fe4d4b42b1cc7c71bd;p=thirdparty%2Futil-linux.git libmount: (context) ask for utab path only once Signed-off-by: Karel Zak --- diff --git a/libmount/src/context.c b/libmount/src/context.c index a551ae337f..1ca354f83b 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -2100,7 +2100,7 @@ int mnt_context_merge_mflags(struct libmnt_context *cxt) int mnt_context_prepare_update(struct libmnt_context *cxt) { int rc; - const char *target; + const char *target, *name; unsigned long flags = 0; assert(cxt); @@ -2125,7 +2125,8 @@ int mnt_context_prepare_update(struct libmnt_context *cxt) DBG(CXT, ul_debugobj(cxt, "skip update: NOMTAB flag")); return 0; } - if (!mnt_context_get_writable_tabpath(cxt)) { + name = mnt_context_get_writable_tabpath(cxt); + if (!name) { DBG(CXT, ul_debugobj(cxt, "skip update: no writable destination")); return 0; } @@ -2138,11 +2139,8 @@ int mnt_context_prepare_update(struct libmnt_context *cxt) } if (!cxt->update) { - const char *name = mnt_context_get_writable_tabpath(cxt); - if (cxt->action == MNT_ACT_UMOUNT && is_file_empty(name)) { - DBG(CXT, ul_debugobj(cxt, - "skip update: umount, no table")); + DBG(CXT, ul_debugobj(cxt, "skip update: umount, no table")); return 0; }