From 3c4dd454dd61d9dc96ae32a41ff71a9e626ef458 Mon Sep 17 00:00:00 2001 From: Hartmut Reuter Date: Tue, 3 Feb 2004 05:31:52 +0000 Subject: [PATCH] dumptool-largefile-support-20040202 FIXES 2720 make dumptool support large files --- src/tests/dumptool.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/tests/dumptool.c b/src/tests/dumptool.c index e67d713..57c45a5 100644 --- a/src/tests/dumptool.c +++ b/src/tests/dumptool.c @@ -71,6 +71,7 @@ #include #include #include +#include #include #include @@ -83,6 +84,9 @@ #include #include +#ifdef AFS_LINUX24_ENV +#define _LARGEFILE64_SOURCE 1 +#endif #ifdef RESIDENCY #include #include @@ -309,6 +313,7 @@ main(int argc, char *argv[]) char *p; struct winsize win; FILE *f; + int fd; #ifdef RESIDENCY for (i = 0; i < RS_MAXRESIDENCIES; i++) { @@ -430,12 +435,22 @@ main(int argc, char *argv[]) * Try opening the dump file */ - if ((f = fopen(argv[optind], "rb")) == NULL) { +#ifdef O_LARGEFILE + if ((fd = open(argv[optind], O_RDONLY | O_LARGEFILE)) < 0) { +#else + if ((fd = open(argv[optind], O_RDONLY)) < 0) { +#endif fprintf(stderr, "open of dumpfile %s failed: %s\n", argv[optind], strerror(errno)); exit(1); } + if ((f = fdopen(fd, "rb")) == NULL) { + fprintf(stderr, "fdopen of dumpfile %s failed: %s\n", argv[optind], + strerror(errno)); + exit(1); + } + if (ReadDumpHeader(f, &dheader)) { fprintf(stderr, "Failed to read dump header!\n"); exit(1); -- 1.9.4