diff options
author | Dan Albert <danalbert@google.com> | 2016-02-02 15:35:33 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2016-02-02 16:33:01 -0800 |
commit | 879785074ca93e13896ce364a45eb5cc17081c4a (patch) | |
tree | 53c9f2456a600403f9cbea126c0c3690b68982c8 /f2fs_utils | |
parent | dd681db9a7978abeb783af206406cfcae0b8514d (diff) | |
download | extras-879785074ca93e13896ce364a45eb5cc17081c4a.tar.gz |
Fix warnings in system/extras.
Bug: http://b/26936282
Change-Id: I1b9c6c9bb06944c32abcb871279d056eea0fb11a
Diffstat (limited to 'f2fs_utils')
-rw-r--r-- | f2fs_utils/Android.mk | 3 | ||||
-rw-r--r-- | f2fs_utils/f2fs_ioutils.c | 13 | ||||
-rw-r--r-- | f2fs_utils/make_f2fs_main.c | 5 |
3 files changed, 15 insertions, 6 deletions
diff --git a/f2fs_utils/Android.mk b/f2fs_utils/Android.mk index 2bc190f3..647c390b 100644 --- a/f2fs_utils/Android.mk +++ b/f2fs_utils/Android.mk @@ -11,11 +11,13 @@ LOCAL_STATIC_LIBRARIES := \ libsparse_host \ libz LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs +LOCAL_CFLAGS := -Wno-unused-parameter include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := f2fs_ioutils.c LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs +LOCAL_CFLAGS := -Wno-unused-parameter LOCAL_STATIC_LIBRARIES := \ libselinux \ libsparse_host \ @@ -64,6 +66,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libf2fs_utils_static LOCAL_SRC_FILES := f2fs_utils.c LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs +LOCAL_CFLAGS := -Wno-unused-parameter LOCAL_STATIC_LIBRARIES := \ libsparse_static include $(BUILD_STATIC_LIBRARY) diff --git a/f2fs_utils/f2fs_ioutils.c b/f2fs_utils/f2fs_ioutils.c index a050cf8f..01efd53f 100644 --- a/f2fs_utils/f2fs_ioutils.c +++ b/f2fs_utils/f2fs_ioutils.c @@ -28,8 +28,11 @@ #define _LARGEFILE64_SOURCE +#include <assert.h> #include <asm/types.h> +#include <dlfcn.h> #include <errno.h> +#include <fcntl.h> #include <linux/fs.h> #include <stdio.h> #include <stdlib.h> @@ -37,10 +40,7 @@ #include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> -#include <fcntl.h> -#include <dlfcn.h> - -#include <assert.h> +#include <unistd.h> #include <f2fs_fs.h> #include <f2fs_format_utils.h> @@ -98,7 +98,10 @@ static int dev_write_fd(void *buf, __u64 offset, size_t len) { if (lseek64(config.fd, (off64_t)offset, SEEK_SET) < 0) return -1; - if (write(config.fd, buf, len) != len) + ssize_t written = write(config.fd, buf, len); + if (written == -1) + return -1; + if ((size_t)written != len) return -1; return 0; } diff --git a/f2fs_utils/make_f2fs_main.c b/f2fs_utils/make_f2fs_main.c index 84042660..1e0dd876 100644 --- a/f2fs_utils/make_f2fs_main.c +++ b/f2fs_utils/make_f2fs_main.c @@ -17,8 +17,9 @@ #include <fcntl.h> #include <libgen.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> +#include <string.h> +#include <unistd.h> #if defined(__linux__) #include <linux/fs.h> @@ -26,6 +27,8 @@ #include <sys/disk.h> #endif +#include "make_f2fs.h" + #ifndef USE_MINGW /* O_BINARY is windows-specific flag */ #define O_BINARY 0 #endif |