diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-05-05 21:39:23 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-05 21:39:25 +0200 |
commit | f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7 (patch) | |
tree | c268c8d7004621b7f1336d75b985876349568ccb | |
parent | Merge "Update the comment for obsolete symlink handling ." (diff) | |
parent | recovery: update mkfs.f2fs args to match f2fs-tools 1.8.0 (diff) | |
download | android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.tar android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.tar.gz android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.tar.bz2 android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.tar.lz android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.tar.xz android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.tar.zst android_bootable_recovery-f347c1abcac3bb1684d1ae329e3c229e7bf0b5b7.zip |
-rw-r--r-- | roots.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -232,14 +232,14 @@ int format_volume(const char* volume, const char* directory) { << ") not supported on " << v->fs_type; return -1; } - char *num_sectors; - if (asprintf(&num_sectors, "%zd", length / 512) <= 0) { + char *num_sectors = nullptr; + if (length >= 512 && asprintf(&num_sectors, "%zd", length / 512) <= 0) { LOG(ERROR) << "format_volume: failed to create " << v->fs_type << " command for " << v->blk_device; return -1; } const char *f2fs_path = "/sbin/mkfs.f2fs"; - const char* const f2fs_argv[] = {"mkfs.f2fs", "-t", "-d1", v->blk_device, num_sectors, NULL}; + const char* const f2fs_argv[] = {"mkfs.f2fs", "-t", "-d1", v->blk_device, num_sectors, nullptr}; result = exec_cmd(f2fs_path, (char* const*)f2fs_argv); free(num_sectors); |