AOSP: Fix android build warnings in e2fsdroid and libext2fs

Change-Id: I23b7abc8af87d87786523944186de1321726a529
From AOSP commit: 424fa8ce373566040ae6ba31151bfbef566b7166
This commit is contained in:
Jin Qian 2017-08-10 11:12:16 -07:00 committed by Theodore Ts'o
parent 8374979bd8
commit 8f8f7a7175
4 changed files with 10 additions and 5 deletions

View 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);

View 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) {

View 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;

View 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;
}