summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaozhiyuan2015-10-20 01:28:52 -0500
committerElliott Hughes2015-10-20 16:15:31 -0500
commitf21f0f16e7056eb5c9029e4aa82b17958a744bb7 (patch)
treedae976f1296518a1a3b6b1022692cb7c03209c0e /libsparse
parent56543606b55e1e1455ef5c0bf9aa9f4febab967f (diff)
downloadplatform-system-core-f21f0f16e7056eb5c9029e4aa82b17958a744bb7.tar.gz
platform-system-core-f21f0f16e7056eb5c9029e4aa82b17958a744bb7.tar.xz
platform-system-core-f21f0f16e7056eb5c9029e4aa82b17958a744bb7.zip
Fix parameter to lseek
Change-Id: I9c497a3ebc24ca1db92d0b9d3d1e9ac49dc40f75
Diffstat (limited to 'libsparse')
-rw-r--r--libsparse/simg2img.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libsparse/simg2img.c b/libsparse/simg2img.c
index 95e9b5bea..b9b438e63 100644
--- a/libsparse/simg2img.c
+++ b/libsparse/simg2img.c
@@ -40,7 +40,6 @@ int main(int argc, char *argv[])
40 int in; 40 int in;
41 int out; 41 int out;
42 int i; 42 int i;
43 int ret;
44 struct sparse_file *s; 43 struct sparse_file *s;
45 44
46 if (argc < 3) { 45 if (argc < 3) {
@@ -71,10 +70,12 @@ int main(int argc, char *argv[])
71 exit(-1); 70 exit(-1);
72 } 71 }
73 72
74 lseek(out, SEEK_SET, 0); 73 if (lseek(out, 0, SEEK_SET) == -1) {
74 perror("lseek failed");
75 exit(EXIT_FAILURE);
76 }
75 77
76 ret = sparse_file_write(s, out, false, false, false); 78 if (sparse_file_write(s, out, false, false, false) < 0) {
77 if (ret < 0) {
78 fprintf(stderr, "Cannot write output file\n"); 79 fprintf(stderr, "Cannot write output file\n");
79 exit(-1); 80 exit(-1);
80 } 81 }