]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix build problems on the Hurd OS
authorTheodore Ts'o <tytso@mit.edu>
Sat, 10 Mar 2018 21:17:05 +0000 (16:17 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 11 Mar 2018 02:23:16 +0000 (21:23 -0500)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/inline_data.c
misc/mke2fs.c

index 0cf80b9a033d7637a31ea763352597058f77c16c..b62fb676931f593ad96e6dc6797311d6e3a87ad4 100644 (file)
@@ -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);
index 3fb5cc49b1d25d44f2824329a3fa6919a0088bb6..e18d9bc6628bad70d53a317b078f5b81df06105e 100644 (file)
@@ -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);