diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-03-10 16:17:05 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-03-10 21:23:16 -0500 |
commit | 4d32184d220bc3a56d3630d00a8c696389fe25ee (patch) | |
tree | 9597caa366fec9915590385c64e103d7481c8a08 /misc | |
parent | b2428898a8b51454b6220d714aaf81d44f22fe6d (diff) | |
download | android_external_e2fsprogs-4d32184d220bc3a56d3630d00a8c696389fe25ee.tar.gz android_external_e2fsprogs-4d32184d220bc3a56d3630d00a8c696389fe25ee.tar.bz2 android_external_e2fsprogs-4d32184d220bc3a56d3630d00a8c696389fe25ee.zip |
Fix build problems on the Hurd OS
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/mke2fs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 3fb5cc49..e18d9bc6 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -16,7 +16,7 @@ * enforced (but it's not much fun on a character device :-). */ -#define _XOPEN_SOURCE 600 /* for inclusion of PATH_MAX */ +#define _XOPEN_SOURCE 600 #include "config.h" #include <stdio.h> @@ -117,7 +117,6 @@ const char *src_root_dir; /* Copy files from the specified directory */ static char *undo_file; static int android_sparse_file; /* -E android_sparse */ -static char *android_sparse_params; static profile_t profile; @@ -2871,17 +2870,19 @@ int main (int argc, char *argv[]) if (!quiet) flags |= EXT2_FLAG_PRINT_PROGRESS; if (android_sparse_file) { - android_sparse_params = malloc(PATH_MAX + 32); + char *android_sparse_params = malloc(strlen(device_name) + 48); + if (!android_sparse_params) { com_err(program_name, ENOMEM, "%s", _("in malloc for android_sparse_params")); exit(1); } - snprintf(android_sparse_params, PATH_MAX + 32, "(%s):%u:%u", + sprintf(android_sparse_params, "(%s):%u:%u", device_name, fs_param.s_blocks_count, 1024 << fs_param.s_log_block_size); retval = ext2fs_initialize(android_sparse_params, flags, &fs_param, sparse_io_manager, &fs); + free(android_sparse_params); } else retval = ext2fs_initialize(device_name, flags, &fs_param, io_ptr, &fs); |