summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-10-20 21:36:49 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-10-20 21:36:49 +0000
commit4a8d1255dec24716b537a742ae67c0bc5ad8a41e (patch)
treedae976f1296518a1a3b6b1022692cb7c03209c0e
parent56543606b55e1e1455ef5c0bf9aa9f4febab967f (diff)
parentf21f0f16e7056eb5c9029e4aa82b17958a744bb7 (diff)
downloadcore-4a8d1255dec24716b537a742ae67c0bc5ad8a41e.tar.gz
core-4a8d1255dec24716b537a742ae67c0bc5ad8a41e.tar.bz2
core-4a8d1255dec24716b537a742ae67c0bc5ad8a41e.zip
Merge "Fix parameter to lseek"
-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[])
int in;
int out;
int i;
- int ret;
struct sparse_file *s;
if (argc < 3) {
@@ -71,10 +70,12 @@ int main(int argc, char *argv[])
exit(-1);
}
- lseek(out, SEEK_SET, 0);
+ if (lseek(out, 0, SEEK_SET) == -1) {
+ perror("lseek failed");
+ exit(EXIT_FAILURE);
+ }
- ret = sparse_file_write(s, out, false, false, false);
- if (ret < 0) {
+ if (sparse_file_write(s, out, false, false, false) < 0) {
fprintf(stderr, "Cannot write output file\n");
exit(-1);
}