]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
AOSP: Fix android build warnings in e2fsdroid and libext2fs
authorJin Qian <jinqian@google.com>
Thu, 10 Aug 2017 18:12:16 +0000 (11:12 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 26 Feb 2018 17:23:08 +0000 (12:23 -0500)
Change-Id: I23b7abc8af87d87786523944186de1321726a529
From AOSP commit: 424fa8ce373566040ae6ba31151bfbef566b7166

contrib/android/e2fsdroid.c
contrib/android/ext2simg.c
contrib/android/perms.c
lib/ext2fs/sparse_io.c

index f043822bef5f9ab92e71812585d42ff59ce59010..c73b0be522542fac259f7bc6485f5fe9cdb2028e 100644 (file)
@@ -1,3 +1,5 @@
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <getopt.h>
 #include <string.h>
@@ -41,7 +43,10 @@ static char *absolute_path(const char *file)
        char cwd[PATH_MAX];
 
        if (file[0] != '/') {
-               getcwd(cwd, PATH_MAX);
+               if (getcwd(cwd, PATH_MAX) == NULL) {
+                       fprintf(stderr, "Failed to getcwd\n");
+                       exit(EXIT_FAILURE);
+               }
                ret = malloc(strlen(cwd) + 1 + strlen(file) + 1);
                if (ret)
                        sprintf(ret, "%s/%s", cwd, file);
index fcefe1d743c691a5898bc599a450fda42dd9db8c..017e16ff79e09e3bc0d97cdab0fd8f8a66a42ce0 100644 (file)
@@ -179,7 +179,6 @@ int main(int argc, char *argv[])
 {
        int opt;
        int out_fd;
-       errcode_t retval;
        struct sparse_file *s;
 
        while ((opt = getopt(argc, argv, "czS")) != -1) {
index 1a822cfea4fa2673539a95f233fa905f96759cae..dde90d96f6d2dcb26c54e670394ba4ac592e048f 100644 (file)
@@ -282,8 +282,8 @@ errcode_t __android_configure_fs(ext2_filsys fs, char *src_dir,
 
 errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out,
                               char *mountpoint,
-                              struct selinux_opt *seopts,
-                              unsigned int nopt,
+                              struct selinux_opt *seopts EXT2FS_ATTR((unused)),
+                              unsigned int nopt EXT2FS_ATTR((unused)),
                               char *fs_config_file, time_t fixed_time)
 {
        errcode_t retval;
index a83baf1f5c20397208a81a47de7fc6a05a9c5b9d..1b39b2ec43afa6290c7d121cb70aff463b7233e1 100644 (file)
@@ -270,7 +270,8 @@ static errcode_t sparse_merge_blocks(struct sparse_map *sm, uint64_t start,
 
        buf = calloc(num, block_size);
        if (!buf) {
-               fprintf(stderr, "failed to alloc %lu\n", num * block_size);
+               fprintf(stderr, "failed to alloc %llu\n",
+                       (unsigned long long)num * block_size);
                return EXT2_ET_NO_MEMORY;
        }