diff options
author | David 'Digit' Turner <digit@google.com> | 2014-06-16 20:51:45 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-16 20:51:45 +0000 |
commit | f5a6b34a9a6b3827f3f2cad111bf7eae3f1f034b (patch) | |
tree | 74f6bd2e24d4ea3841d9dc4eb8c5c2e6f038c0ab /ext4_utils/ext4_utils.c | |
parent | aad1accb587aa708012b329c784332dcc9991de6 (diff) | |
parent | fb0c62963b5fe1b4f36e281c4c02d98d737d08ee (diff) | |
download | extras-f5a6b34a9a6b3827f3f2cad111bf7eae3f1f034b.tar.gz |
am fb0c6296: am 9c82554e: Merge "Ignore wipe operation on non-block devices."
* commit 'fb0c62963b5fe1b4f36e281c4c02d98d737d08ee':
Ignore wipe operation on non-block devices.
Diffstat (limited to 'ext4_utils/ext4_utils.c')
-rw-r--r-- | ext4_utils/ext4_utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.c index e83f055d..ad0491f6 100644 --- a/ext4_utils/ext4_utils.c +++ b/ext4_utils/ext4_utils.c @@ -441,6 +441,20 @@ u64 get_block_device_size(int fd) return size; } +int is_block_device_fd(int fd) +{ +#ifdef USE_MINGW + return 0; +#else + struct stat st; + int ret = fstat(fd, &st); + if (ret < 0) + return 0; + + return S_ISBLK(st.st_mode); +#endif +} + u64 get_file_size(int fd) { struct stat buf; |