diff options
author | David 'Digit' Turner <digit@google.com> | 2014-06-12 20:54:50 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-06-13 10:16:30 +0200 |
commit | eb5fcc3e932a8ccac1b580788a213c7782aff31b (patch) | |
tree | a1ae84a82d9522772b1bf14dea0e293b689d2dcd /ext4_utils/make_ext4fs.c | |
parent | b733b3c7b0601326801d43f548aa139ca0be721e (diff) | |
download | extras-eb5fcc3e932a8ccac1b580788a213c7782aff31b.tar.gz |
Ignore wipe operation on non-block devices.
The implementation of make_ext4fs() calls make_ext4fs_internal() by
forcing the |wipe| parameter to true, which is problematic when the
library is used within the emulator (the wipe operation will always
fail on non-Linux platforms).
This patch does the following:
- Add a 'is_block_device_fd()' function to check that a file descriptor
points to a real block device.
- Modify the implementation of wipe_block_device() uses it to return
silently when trying to wipe a non-block-device file.
- Add a WIPE_IS_SUPPORTED flag in wipe.h that indicates whether
block device wiping is supported on the current platform
(for now, this is only the case on Linux).
BUG=NONE
Change-Id: I62b62b7c3e99b465c3b876154231e7c2fe541b23
Diffstat (limited to 'ext4_utils/make_ext4fs.c')
-rw-r--r-- | ext4_utils/make_ext4fs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c index f164883e..6a0f8758 100644 --- a/ext4_utils/make_ext4fs.c +++ b/ext4_utils/make_ext4fs.c @@ -623,8 +623,9 @@ int make_ext4fs_internal(int fd, const char *_directory, aux_info.sb->s_blocks_count_lo - aux_info.sb->s_free_blocks_count_lo, aux_info.sb->s_blocks_count_lo); - if (wipe) + if (wipe && WIPE_IS_SUPPORTED) { wipe_block_device(fd, info.len); + } write_ext4_image(fd, gzip, sparse, crc); |