|
|
1f0cb0 |
From 868d26ab9b54545a67150ba59a5aa9d47cb4e2d8 Mon Sep 17 00:00:00 2001
|
|
|
1f0cb0 |
From: Lukas Czerner <lczerner@redhat.com>
|
|
|
1f0cb0 |
Date: Thu, 20 Feb 2014 16:02:29 +0100
|
|
|
1f0cb0 |
Subject: [PATCH 01/16] e2fsprogs: introduce ext2fs_close_free() helper
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
commit 47fee2ef6a23ae06f680336ffde57caa64604a4c
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
Currently there are many uses of ext2fs_close() which might be wrong.
|
|
|
1f0cb0 |
First of all ext2fs_close() does not set the ext2_filsys pointer to NULL
|
|
|
1f0cb0 |
so the caller is responsible for clearing it, however there are some
|
|
|
1f0cb0 |
cases there we do not do it.
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
Second of all very small number of users of ext2fs_close() actually
|
|
|
1f0cb0 |
check the return value. If there is a problem in ext2fs_close() it will
|
|
|
1f0cb0 |
not even free the ext2_filsys structure, but majority of users expect it
|
|
|
1f0cb0 |
to do so.
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
To fix both problems this commit introduces a new helper
|
|
|
1f0cb0 |
ext2fs_close_free() which will not only check for the return value and
|
|
|
1f0cb0 |
free the ext2_filsys structure if the call to ext2fs_close2() failed,
|
|
|
1f0cb0 |
but it will also set the ext2_filsys pointer to NULL.
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
Replace every use of ext2fs_close() in e2fsprogs tools with
|
|
|
1f0cb0 |
ext2fs_close_free() - there is no real reason to keep using
|
|
|
1f0cb0 |
ext2fs_close().
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
|
|
1f0cb0 |
---
|
|
|
1f0cb0 |
debugfs/debugfs.c | 6 ++----
|
|
|
1f0cb0 |
e2fsck/scantest.c | 2 +-
|
|
|
1f0cb0 |
e2fsck/unix.c | 20 ++++++++------------
|
|
|
1f0cb0 |
e2fsck/util.c | 2 +-
|
|
|
1f0cb0 |
lib/ext2fs/closefs.c | 12 ++++++++++++
|
|
|
1f0cb0 |
lib/ext2fs/ext2fs.h | 1 +
|
|
|
1f0cb0 |
lib/ext2fs/mkjournal.c | 2 +-
|
|
|
1f0cb0 |
lib/ext2fs/tst_bitmaps.c | 12 ++++--------
|
|
|
1f0cb0 |
misc/dumpe2fs.c | 6 +++---
|
|
|
1f0cb0 |
misc/e2freefrag.c | 2 +-
|
|
|
1f0cb0 |
misc/e2image.c | 4 ++--
|
|
|
1f0cb0 |
misc/e4defrag.c | 2 +-
|
|
|
1f0cb0 |
misc/mke2fs.c | 8 ++++----
|
|
|
1f0cb0 |
misc/tune2fs.c | 6 +++---
|
|
|
1f0cb0 |
resize/main.c | 2 +-
|
|
|
1f0cb0 |
resize/resize2fs.c | 2 +-
|
|
|
1f0cb0 |
16 files changed, 46 insertions(+), 43 deletions(-)
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
|
|
|
1f0cb0 |
index cf7670bc..2082309b 100644
|
|
|
1f0cb0 |
--- a/debugfs/debugfs.c
|
|
|
1f0cb0 |
+++ b/debugfs/debugfs.c
|
|
|
1f0cb0 |
@@ -131,10 +131,9 @@ static void open_filesystem(char *device, int open_flags, blk64_t superblock,
|
|
|
1f0cb0 |
return;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
errout:
|
|
|
1f0cb0 |
- retval = ext2fs_close(current_fs);
|
|
|
1f0cb0 |
+ retval = ext2fs_close_free(¤t_fs);
|
|
|
1f0cb0 |
if (retval)
|
|
|
1f0cb0 |
com_err(device, retval, "while trying to close filesystem");
|
|
|
1f0cb0 |
- current_fs = NULL;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
void do_open_filesys(int argc, char **argv)
|
|
|
1f0cb0 |
@@ -237,10 +236,9 @@ static void close_filesystem(NOARGS)
|
|
|
1f0cb0 |
if (retval)
|
|
|
1f0cb0 |
com_err("ext2fs_write_block_bitmap", retval, 0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
- retval = ext2fs_close(current_fs);
|
|
|
1f0cb0 |
+ retval = ext2fs_close_free(¤t_fs);
|
|
|
1f0cb0 |
if (retval)
|
|
|
1f0cb0 |
com_err("ext2fs_close", retval, 0);
|
|
|
1f0cb0 |
- current_fs = NULL;
|
|
|
1f0cb0 |
return;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
diff --git a/e2fsck/scantest.c b/e2fsck/scantest.c
|
|
|
1f0cb0 |
index 16380b31..61311410 100644
|
|
|
1f0cb0 |
--- a/e2fsck/scantest.c
|
|
|
1f0cb0 |
+++ b/e2fsck/scantest.c
|
|
|
1f0cb0 |
@@ -133,7 +133,7 @@ int main (int argc, char *argv[])
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
print_resource_track(&global_rtrack);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
|
|
|
1f0cb0 |
index d94d5dcd..5fcc9d99 100644
|
|
|
1f0cb0 |
--- a/e2fsck/unix.c
|
|
|
1f0cb0 |
+++ b/e2fsck/unix.c
|
|
|
1f0cb0 |
@@ -456,8 +456,7 @@ static void check_if_skip(e2fsck_t ctx)
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
log_out(ctx, "\n");
|
|
|
1f0cb0 |
skip:
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
- ctx->fs = NULL;
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
e2fsck_free_context(ctx);
|
|
|
1f0cb0 |
exit(FSCK_OK);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
@@ -1303,12 +1302,12 @@ restart:
|
|
|
1f0cb0 |
orig_superblock = ctx->superblock;
|
|
|
1f0cb0 |
get_backup_sb(ctx, fs, ctx->filesystem_name, io_ptr);
|
|
|
1f0cb0 |
if (fs)
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
orig_retval = retval;
|
|
|
1f0cb0 |
retval = try_open_fs(ctx, flags, io_ptr, &fs);
|
|
|
1f0cb0 |
if ((orig_retval == 0) && retval != 0) {
|
|
|
1f0cb0 |
if (fs)
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
log_out(ctx, _("%s: %s while using the "
|
|
|
1f0cb0 |
"backup blocks"),
|
|
|
1f0cb0 |
ctx->program_name,
|
|
|
1f0cb0 |
@@ -1402,7 +1401,7 @@ failure:
|
|
|
1f0cb0 |
* reopen the filesystem after we get the device size.
|
|
|
1f0cb0 |
*/
|
|
|
1f0cb0 |
if (pctx.errcode == EBUSY) {
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
need_restart++;
|
|
|
1f0cb0 |
pctx.errcode =
|
|
|
1f0cb0 |
ext2fs_get_device_size2(ctx->filesystem_name,
|
|
|
1f0cb0 |
@@ -1459,8 +1458,7 @@ failure:
|
|
|
1f0cb0 |
/*
|
|
|
1f0cb0 |
* Restart in order to reopen fs but this time start mmp.
|
|
|
1f0cb0 |
*/
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
- ctx->fs = NULL;
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
flags &= ~EXT2_FLAG_SKIP_MMP;
|
|
|
1f0cb0 |
goto restart;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
@@ -1510,8 +1508,7 @@ failure:
|
|
|
1f0cb0 |
ctx->device_name);
|
|
|
1f0cb0 |
fatal_error(ctx, 0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
- ext2fs_close(ctx->fs);
|
|
|
1f0cb0 |
- ctx->fs = 0;
|
|
|
1f0cb0 |
+ ext2fs_close_free(&ctx->fs);
|
|
|
1f0cb0 |
ctx->flags |= E2F_FLAG_RESTARTED;
|
|
|
1f0cb0 |
goto restart;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
@@ -1690,7 +1687,7 @@ no_journal:
|
|
|
1f0cb0 |
_("while resetting context"));
|
|
|
1f0cb0 |
fatal_error(ctx, 0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
goto restart;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
if (run_result & E2F_FLAG_CANCEL) {
|
|
|
1f0cb0 |
@@ -1772,8 +1769,7 @@ no_journal:
|
|
|
1f0cb0 |
io_channel_flush(ctx->fs->io);
|
|
|
1f0cb0 |
print_resource_track(ctx, NULL, &ctx->global_rtrack, ctx->fs->io);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
- ctx->fs = NULL;
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
free(ctx->journal_name);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
e2fsck_free_context(ctx);
|
|
|
1f0cb0 |
diff --git a/e2fsck/util.c b/e2fsck/util.c
|
|
|
1f0cb0 |
index 9f920b2c..14c9ad48 100644
|
|
|
1f0cb0 |
--- a/e2fsck/util.c
|
|
|
1f0cb0 |
+++ b/e2fsck/util.c
|
|
|
1f0cb0 |
@@ -319,7 +319,7 @@ void preenhalt(e2fsck_t ctx)
|
|
|
1f0cb0 |
if (fs != NULL) {
|
|
|
1f0cb0 |
fs->super->s_state |= EXT2_ERROR_FS;
|
|
|
1f0cb0 |
ext2fs_mark_super_dirty(fs);
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
exit(FSCK_UNCORRECTED);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
|
|
|
1f0cb0 |
index 000ebd87..4db9e194 100644
|
|
|
1f0cb0 |
--- a/lib/ext2fs/closefs.c
|
|
|
1f0cb0 |
+++ b/lib/ext2fs/closefs.c
|
|
|
1f0cb0 |
@@ -437,6 +437,18 @@ errout:
|
|
|
1f0cb0 |
return retval;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
+errcode_t ext2fs_close_free(ext2_filsys *fs_ptr)
|
|
|
1f0cb0 |
+{
|
|
|
1f0cb0 |
+ errcode_t ret;
|
|
|
1f0cb0 |
+ ext2_filsys fs = *fs_ptr;
|
|
|
1f0cb0 |
+
|
|
|
1f0cb0 |
+ ret = ext2fs_close2(fs, 0);
|
|
|
1f0cb0 |
+ if (ret)
|
|
|
1f0cb0 |
+ ext2fs_free(fs);
|
|
|
1f0cb0 |
+ *fs_ptr = NULL;
|
|
|
1f0cb0 |
+ return ret;
|
|
|
1f0cb0 |
+}
|
|
|
1f0cb0 |
+
|
|
|
1f0cb0 |
errcode_t ext2fs_close(ext2_filsys fs)
|
|
|
1f0cb0 |
{
|
|
|
1f0cb0 |
return ext2fs_close2(fs, 0);
|
|
|
1f0cb0 |
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
|
|
|
1f0cb0 |
index 380608b2..643b66c0 100644
|
|
|
1f0cb0 |
--- a/lib/ext2fs/ext2fs.h
|
|
|
1f0cb0 |
+++ b/lib/ext2fs/ext2fs.h
|
|
|
1f0cb0 |
@@ -925,6 +925,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs);
|
|
|
1f0cb0 |
/* closefs.c */
|
|
|
1f0cb0 |
extern errcode_t ext2fs_close(ext2_filsys fs);
|
|
|
1f0cb0 |
extern errcode_t ext2fs_close2(ext2_filsys fs, int flags);
|
|
|
1f0cb0 |
+extern errcode_t ext2fs_close_free(ext2_filsys *fs);
|
|
|
1f0cb0 |
extern errcode_t ext2fs_flush(ext2_filsys fs);
|
|
|
1f0cb0 |
extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags);
|
|
|
1f0cb0 |
extern int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group_block);
|
|
|
1f0cb0 |
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
|
|
|
1f0cb0 |
index d09c4589..52dc99be 100644
|
|
|
1f0cb0 |
--- a/lib/ext2fs/mkjournal.c
|
|
|
1f0cb0 |
+++ b/lib/ext2fs/mkjournal.c
|
|
|
1f0cb0 |
@@ -630,7 +630,7 @@ main(int argc, char **argv)
|
|
|
1f0cb0 |
if (retval) {
|
|
|
1f0cb0 |
printf("Warning, had trouble writing out superblocks.\n");
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
exit(0);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
diff --git a/lib/ext2fs/tst_bitmaps.c b/lib/ext2fs/tst_bitmaps.c
|
|
|
1f0cb0 |
index 57bfd6c8..3a6d1bdc 100644
|
|
|
1f0cb0 |
--- a/lib/ext2fs/tst_bitmaps.c
|
|
|
1f0cb0 |
+++ b/lib/ext2fs/tst_bitmaps.c
|
|
|
1f0cb0 |
@@ -187,8 +187,7 @@ static void setup_filesystem(const char *name,
|
|
|
1f0cb0 |
return;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
errout:
|
|
|
1f0cb0 |
- ext2fs_close(test_fs);
|
|
|
1f0cb0 |
- test_fs = 0;
|
|
|
1f0cb0 |
+ ext2fs_close_free(&test_fs);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
void setup_cmd(int argc, char **argv)
|
|
|
1f0cb0 |
@@ -199,10 +198,8 @@ void setup_cmd(int argc, char **argv)
|
|
|
1f0cb0 |
unsigned int type = EXT2FS_BMAP64_BITARRAY;
|
|
|
1f0cb0 |
int flags = EXT2_FLAG_64BITS;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- if (test_fs) {
|
|
|
1f0cb0 |
- ext2fs_close(test_fs);
|
|
|
1f0cb0 |
- test_fs = 0;
|
|
|
1f0cb0 |
- }
|
|
|
1f0cb0 |
+ if (test_fs)
|
|
|
1f0cb0 |
+ ext2fs_close_free(&test_fs);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
reset_getopt();
|
|
|
1f0cb0 |
while ((c = getopt(argc, argv, "b:i:lt:")) != EOF) {
|
|
|
1f0cb0 |
@@ -242,8 +239,7 @@ void close_cmd(int argc, char **argv)
|
|
|
1f0cb0 |
if (check_fs_open(argv[0]))
|
|
|
1f0cb0 |
return;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- ext2fs_close(test_fs);
|
|
|
1f0cb0 |
- test_fs = 0;
|
|
|
1f0cb0 |
+ ext2fs_close_free(&test_fs);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
|
|
|
1f0cb0 |
index d4bde8e5..cc18ad83 100644
|
|
|
1f0cb0 |
--- a/misc/dumpe2fs.c
|
|
|
1f0cb0 |
+++ b/misc/dumpe2fs.c
|
|
|
1f0cb0 |
@@ -614,7 +614,7 @@ int main (int argc, char ** argv)
|
|
|
1f0cb0 |
if (fs->super->s_feature_incompat &
|
|
|
1f0cb0 |
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
|
|
|
1f0cb0 |
print_journal_information(fs);
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
exit(0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
if ((fs->super->s_feature_compat &
|
|
|
1f0cb0 |
@@ -623,7 +623,7 @@ int main (int argc, char ** argv)
|
|
|
1f0cb0 |
print_inline_journal_information(fs);
|
|
|
1f0cb0 |
list_bad_blocks(fs, 0);
|
|
|
1f0cb0 |
if (header_only) {
|
|
|
1f0cb0 |
- ext2fs_close (fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
exit (0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
retval = ext2fs_read_bitmaps (fs);
|
|
|
1f0cb0 |
@@ -634,7 +634,7 @@ int main (int argc, char ** argv)
|
|
|
1f0cb0 |
error_message(retval));
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
- ext2fs_close (fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
remove_error_table(&et_ext2_error_table);
|
|
|
1f0cb0 |
exit (0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c
|
|
|
1f0cb0 |
index 612ca445..bb72c70d 100644
|
|
|
1f0cb0 |
--- a/misc/e2freefrag.c
|
|
|
1f0cb0 |
+++ b/misc/e2freefrag.c
|
|
|
1f0cb0 |
@@ -215,7 +215,7 @@ static errcode_t get_chunk_info(ext2_filsys fs, struct chunk_info *info,
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
static void close_device(char *device_name, ext2_filsys fs)
|
|
|
1f0cb0 |
{
|
|
|
1f0cb0 |
- int retval = ext2fs_close(fs);
|
|
|
1f0cb0 |
+ int retval = ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
if (retval)
|
|
|
1f0cb0 |
com_err(device_name, retval, "while closing the filesystem.\n");
|
|
|
1f0cb0 |
diff --git a/misc/e2image.c b/misc/e2image.c
|
|
|
1f0cb0 |
index 0537b0d8..98dafa3d 100644
|
|
|
1f0cb0 |
--- a/misc/e2image.c
|
|
|
1f0cb0 |
+++ b/misc/e2image.c
|
|
|
1f0cb0 |
@@ -1415,7 +1415,7 @@ static void install_image(char *device, char *image_fn, int type)
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
close(fd);
|
|
|
1f0cb0 |
- ext2fs_close (fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
static struct ext2_qcow2_hdr *check_qcow2_image(int *fd, char *name)
|
|
|
1f0cb0 |
@@ -1648,7 +1648,7 @@ skip_device:
|
|
|
1f0cb0 |
else
|
|
|
1f0cb0 |
write_image_file(fs, fd);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- ext2fs_close (fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
if (check)
|
|
|
1f0cb0 |
printf(_("%d blocks already contained the data to be copied.\n"),
|
|
|
1f0cb0 |
skipped_blocks);
|
|
|
1f0cb0 |
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
|
|
|
1f0cb0 |
index 1ba3c53a..2c2034cf 100644
|
|
|
1f0cb0 |
--- a/misc/e4defrag.c
|
|
|
1f0cb0 |
+++ b/misc/e4defrag.c
|
|
|
1f0cb0 |
@@ -1863,7 +1863,7 @@ int main(int argc, char *argv[])
|
|
|
1f0cb0 |
feature_incompat = fs->super->s_feature_incompat;
|
|
|
1f0cb0 |
log_groups_per_flex = fs->super->s_log_groups_per_flex;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
switch (arg_type) {
|
|
|
1f0cb0 |
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
|
|
|
1f0cb0 |
index 8952a5fe..2787a127 100644
|
|
|
1f0cb0 |
--- a/misc/mke2fs.c
|
|
|
1f0cb0 |
+++ b/misc/mke2fs.c
|
|
|
1f0cb0 |
@@ -1662,7 +1662,7 @@ profile_error:
|
|
|
1f0cb0 |
printf(_("Using journal device's blocksize: %d\n"), blocksize);
|
|
|
1f0cb0 |
fs_param.s_log_block_size =
|
|
|
1f0cb0 |
int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE);
|
|
|
1f0cb0 |
- ext2fs_close(jfs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&jfs;;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
if (optind < argc) {
|
|
|
1f0cb0 |
@@ -2585,7 +2585,7 @@ int main (int argc, char *argv[])
|
|
|
1f0cb0 |
if (fs->super->s_feature_incompat &
|
|
|
1f0cb0 |
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
|
|
|
1f0cb0 |
create_journal_dev(fs);
|
|
|
1f0cb0 |
- exit(ext2fs_close(fs) ? 1 : 0);
|
|
|
1f0cb0 |
+ exit(ext2fs_close_free(&fs) ? 1 : 0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
if (bad_blocks_filename)
|
|
|
1f0cb0 |
@@ -2702,7 +2702,7 @@ int main (int argc, char *argv[])
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
if (!quiet)
|
|
|
1f0cb0 |
printf("%s", _("done\n"));
|
|
|
1f0cb0 |
- ext2fs_close(jfs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&jfs;;
|
|
|
1f0cb0 |
free(journal_device);
|
|
|
1f0cb0 |
} else if ((journal_size) ||
|
|
|
1f0cb0 |
(fs_param.s_feature_compat &
|
|
|
1f0cb0 |
@@ -2761,7 +2761,7 @@ no_journal:
|
|
|
1f0cb0 |
"filesystem accounting information: "));
|
|
|
1f0cb0 |
checkinterval = fs->super->s_checkinterval;
|
|
|
1f0cb0 |
max_mnt_count = fs->super->s_max_mnt_count;
|
|
|
1f0cb0 |
- retval = ext2fs_close(fs);
|
|
|
1f0cb0 |
+ retval = ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
if (retval) {
|
|
|
1f0cb0 |
fprintf(stderr, "%s",
|
|
|
1f0cb0 |
_("\nWarning, had trouble writing out superblocks.\n"));
|
|
|
1f0cb0 |
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
|
|
|
1f0cb0 |
index d2aa125d..1bedca20 100644
|
|
|
1f0cb0 |
--- a/misc/tune2fs.c
|
|
|
1f0cb0 |
+++ b/misc/tune2fs.c
|
|
|
1f0cb0 |
@@ -682,7 +682,7 @@ static int add_journal(ext2_filsys fs)
|
|
|
1f0cb0 |
fflush(stdout);
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
retval = ext2fs_add_journal_device(fs, jfs);
|
|
|
1f0cb0 |
- ext2fs_close(jfs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&jfs;;
|
|
|
1f0cb0 |
if (retval) {
|
|
|
1f0cb0 |
com_err(program_name, retval,
|
|
|
1f0cb0 |
_("while adding filesystem to journal on %s"),
|
|
|
1f0cb0 |
@@ -1987,7 +1987,7 @@ retry_open:
|
|
|
1f0cb0 |
goto closefs;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
if (io_ptr != io_ptr_orig) {
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
goto retry_open;
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
@@ -2267,5 +2267,5 @@ closefs:
|
|
|
1f0cb0 |
exit(1);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
- return (ext2fs_close(fs) ? 1 : 0);
|
|
|
1f0cb0 |
+ return (ext2fs_close_free(&fs) ? 1 : 0);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
diff --git a/resize/main.c b/resize/main.c
|
|
|
1f0cb0 |
index 80903b22..3951b091 100644
|
|
|
1f0cb0 |
--- a/resize/main.c
|
|
|
1f0cb0 |
+++ b/resize/main.c
|
|
|
1f0cb0 |
@@ -484,7 +484,7 @@ int main (int argc, char ** argv)
|
|
|
1f0cb0 |
_("Please run 'e2fsck -fy %s' to fix the filesystem\n"
|
|
|
1f0cb0 |
"after the aborted resize operation.\n"),
|
|
|
1f0cb0 |
device_name);
|
|
|
1f0cb0 |
- ext2fs_close(fs);
|
|
|
1f0cb0 |
+ ext2fs_close_free(&fs);
|
|
|
1f0cb0 |
exit(1);
|
|
|
1f0cb0 |
}
|
|
|
1f0cb0 |
printf(_("The filesystem on %s is now %llu blocks long.\n\n"),
|
|
|
1f0cb0 |
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
|
|
|
1f0cb0 |
index d6fc5337..a73390de 100644
|
|
|
1f0cb0 |
--- a/resize/resize2fs.c
|
|
|
1f0cb0 |
+++ b/resize/resize2fs.c
|
|
|
1f0cb0 |
@@ -195,7 +195,7 @@ errcode_t resize_fs(ext2_filsys fs, blk64_t *new_size, int flags,
|
|
|
1f0cb0 |
rfs->new_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
print_resource_track(rfs, &overall_track, fs->io);
|
|
|
1f0cb0 |
- retval = ext2fs_close(rfs->new_fs);
|
|
|
1f0cb0 |
+ retval = ext2fs_close_free(&rfs->new_fs);
|
|
|
1f0cb0 |
if (retval)
|
|
|
1f0cb0 |
goto errout;
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
--
|
|
|
1f0cb0 |
2.20.1
|
|
|
1f0cb0 |
|