diff options
author | Karel Zak | 2013-08-21 16:07:51 +0200 |
---|---|---|
committer | Karel Zak | 2013-08-21 16:07:51 +0200 |
commit | 50fccba1ab7097bcb69048bbe929ab739be3fc1e (patch) | |
tree | a0682409c49b721e7dc9e3082fc92b909586f7c2 /sys-utils/eject.c | |
parent | libmount: add reference counter to libmnt_table (diff) | |
download | kernel-qcow2-util-linux-50fccba1ab7097bcb69048bbe929ab739be3fc1e.tar.gz kernel-qcow2-util-linux-50fccba1ab7097bcb69048bbe929ab739be3fc1e.tar.xz kernel-qcow2-util-linux-50fccba1ab7097bcb69048bbe929ab739be3fc1e.zip |
misc: use libmnt_table reference counter
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/eject.c')
-rw-r--r-- | sys-utils/eject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys-utils/eject.c b/sys-utils/eject.c index b8e16c320..03744c7e7 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -106,7 +106,6 @@ static long int c_arg; static long int x_arg; struct libmnt_table *mtab; -struct libmnt_cache *cache; static void vinfo(const char *fmt, va_list va) { @@ -725,13 +724,15 @@ static int device_get_mountpoint(char **devname, char **mnt) *mnt = NULL; if (!mtab) { + struct libmnt_cache *cache; + mtab = mnt_new_table(); if (!mtab) err(EXIT_FAILURE, _("failed to initialize libmount table")); - if (!cache) - cache = mnt_new_cache(); + cache = mnt_new_cache(); mnt_table_set_cache(mtab, cache); + mnt_unref_cache(cache); if (p_option) rc = mnt_table_parse_file(mtab, _PATH_PROC_MOUNTINFO); @@ -1147,8 +1148,7 @@ int main(int argc, char **argv) free(device); free(mountpoint); - mnt_free_table(mtab); - mnt_unref_cache(cache); + mnt_unref_table(mtab); return EXIT_SUCCESS; } |