From 0d1e92d22d3acb510d295452c8a89ad16c0668e1 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 18 Jun 2008 15:18:06 +0200 Subject: [PATCH 1/1] Add large file support. This is needed on 32bit systems for files > 2G. Only tested on Linux so far. --- Makefile | 9 ++++++++- create.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 8dcf26d..60f3c28 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,13 @@ CPPFLAGS += -Werror-implicit-function-declaration CPPFLAGS += -Wmissing-format-attribute CPPFLAGS += -Wunused-macros CPPFLAGS += -Wbad-function-cast +CPPFLAGS += -D_LARGEFILE64_SOURCE +CPPFLAGS += $(shell getconf LFS64_CFLAGS) + +LDFLAGS += -D_LARGEFILE64_SOURCE +LDFLAGS += $(shell getconf LFS64_LDFLAGS) +LDFLAGS += $(shell getconf LFS64_LIBS) + Makefile.deps: $(wildcard *.c *.h) gcc -MM -MG *.c > $@ @@ -19,7 +26,7 @@ Makefile.deps: $(wildcard *.c *.h) -include Makefile.deps adu: $(objects) - $(CC) -o $@ $(objects) -lcrypto -losl + $(CC) -o $@ $(LDFLAGS) $(objects) -lcrypto -losl cmdline.o: cmdline.c cmdline.h $(CC) -c $(CPPFLAGS) $< diff --git a/create.c b/create.c index 5c243d8..47c7155 100644 --- a/create.c +++ b/create.c @@ -133,7 +133,7 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num) } while ((entry = readdir(dir))) { mode_t m; - struct stat s; + struct stat64 s; uint32_t uid; uint64_t size; struct user_info *ui; @@ -142,8 +142,8 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num) continue; if (!strcmp(entry->d_name, "..")) continue; - if (lstat(entry->d_name, &s) == -1) { - WARNING_LOG("lstat error for %s/%s (%s)\n", + if (lstat64(entry->d_name, &s) == -1) { + WARNING_LOG("lstat64 error for %s/%s (%s)\n", dirname, entry->d_name, strerror(errno)); continue; } -- 2.39.2