Permalink
Browse files

use lseek64

  • Loading branch information...
1 parent 0ac4eb0 commit 1c6bf6c5925d17df911f7f68b5cf38888f9c41f5 Kazuho Oku committed Nov 18, 2009
Showing with 6 additions and 1 deletion.
  1. +6 −1 blockdiff_merge.c
View
@@ -1,6 +1,8 @@
+#define _LARGEFILE64_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <unistd.h>
#include <openssl/crypto.h>
@@ -13,6 +15,7 @@ int main(int argc, char **argv)
int blocksize;
size_t rlen;
long long offset;
+ int debug = getenv("DEBUG") != NULL;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
@@ -39,7 +42,9 @@ int main(int argc, char **argv)
perror("unexpected eof");
exit(2);
}
- if (lseek(fd, offset, SEEK_SET) == -1) {
+ if (debug)
+ fprintf(stderr, "writing at:%lld\n", offset);
+ if (lseek64(fd, offset, SEEK_SET) == -1) {
perror("seek failed");
exit(3);
}

0 comments on commit 1c6bf6c

Please sign in to comment.