From efac5a7f0d19b06276520b35bc986540eb22c34d Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 2 Apr 2007 18:30:46 -0400 Subject: [PATCH] debugfs: support > 2GB files for the dump and rdump commands Add _GNU_SOURCE define to make sure O_LARGEFILE is defined for do_dump(), and use O_LARGEFILE when writing files using do_rdump(). Addresses Debian Bug: #412614 Signed-off-by: "Theodore Ts'o" --- debugfs/ChangeLog | 6 ++++++ debugfs/dump.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index d6fd6717f..6a4de62c3 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,9 @@ +2007-04-02 Theodore Tso + + * dump.c (do_rdump): Use O_LARGEFILE when creating files. Add a + #define of GNU_SOURCE so that the dump and rdump commands + work with files > 2GB. (Addresses Debian Bug: #412614) + 2007-03-29 Theodore Tso * debugfs.c (do_print_working_directory): Handle the case if diff --git a/debugfs/dump.c b/debugfs/dump.c index 577959e71..2cfe623ac 100644 --- a/debugfs/dump.c +++ b/debugfs/dump.c @@ -5,6 +5,8 @@ * under the terms of the GNU Public License. */ +#define _GNU_SOURCE /* for O_LARGEFILE */ + #include #include #include @@ -256,7 +258,7 @@ static void rdump_inode(ext2_ino_t ino, struct ext2_inode *inode, rdump_symlink(ino, inode, fullname); else if (LINUX_S_ISREG(inode->i_mode)) { int fd; - fd = open(fullname, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); + fd = open(fullname, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, S_IRWXU); if (fd == -1) { com_err("rdump", errno, "while dumping %s", fullname); goto errout; -- 2.47.2