Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from koreader/chrox-master
zsync binary for Android that will be used by OTA
- Loading branch information
Showing
7 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/c/libzsync/zsync.c b/c/libzsync/zsync.c | ||
index 8b18d42..971d2c6 100644 | ||
--- a/c/libzsync/zsync.c | ||
+++ b/c/libzsync/zsync.c | ||
@@ -41,6 +41,8 @@ | ||
#include <string.h> | ||
#include <ctype.h> | ||
#include <time.h> | ||
+#include <errno.h> | ||
+#include <fcntl.h> | ||
|
||
#include <arpa/inet.h> | ||
|
||
@@ -533,6 +535,17 @@ int zsync_rename_file(struct zsync_state *zs, const char *f) { | ||
free(rf); | ||
zs->cur_filename = strdup(f); | ||
} | ||
+ else if (errno == EXDEV) { | ||
+ int in_fd = open(rf, O_RDONLY); | ||
+ int out_fd = open(f, O_WRONLY); | ||
+ char buf[8192]; | ||
+ while(1) { | ||
+ ssize_t result = read(in_fd, &buf[0], sizeof(buf)); | ||
+ if (!result) break; | ||
+ write(out_fd, &buf[0], result); | ||
+ } | ||
+ unlink(rf); | ||
+ } | ||
else | ||
perror("rename"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/c/configure.ac b/c/configure.ac | ||
index 87b0be1..6b5596f 100644 | ||
--- a/c/configure.ac | ||
+++ b/c/configure.ac | ||
@@ -32,7 +32,7 @@ AC_TYPE_SIZE_T | ||
AC_CHECK_FUNCS(memcpy pwrite pread mkstemp) | ||
|
||
X_TYPE_SOCKLEN_T | ||
-X_TYPE_IN_PORT_T | ||
+#X_TYPE_IN_PORT_T | ||
X_DECL_H_ERRNO | ||
|
||
dnl Solaris needs -lsocket - and we need this for the getaddrinfo test | ||
diff --git a/c/libzsync/sha1.h b/c/libzsync/sha1.h | ||
index 3946505..c898185 100644 | ||
--- a/c/libzsync/sha1.h | ||
+++ b/c/libzsync/sha1.h | ||
@@ -10,6 +10,7 @@ | ||
#define _SHA1_H | ||
|
||
#include "config.h" | ||
+#include <stdio.h> | ||
|
||
#ifdef HAVE_INTTYPES_H | ||
#include <inttypes.h> |