From: Theodore Ts'o Date: Sat, 10 Mar 2018 21:17:05 +0000 (-0500) Subject: Fix build problems on the Hurd OS X-Git-Tag: v1.44.1~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d32184d220bc3a56d3630d00a8c696389fe25ee;p=thirdparty%2Fe2fsprogs.git Fix build problems on the Hurd OS Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c index 0cf80b9a0..b62fb6769 100644 --- a/lib/ext2fs/inline_data.c +++ b/lib/ext2fs/inline_data.c @@ -693,7 +693,7 @@ static errcode_t dir_test(ext2_filsys fs) const char *parent_name = "test"; ext2_ino_t parent, dir, tmp; errcode_t retval; - char dirname[PATH_MAX]; + char dirname[32]; int i; retval = ext2fs_mkdir(fs, 11, 11, stub_name); diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 3fb5cc49b..e18d9bc66 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 @@ -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);