Whamcloud - gitweb
debugfs: support > 2GB files for the dump and rdump commands
authorTheodore Ts'o <tytso@mit.edu>
Mon, 2 Apr 2007 22:30:46 +0000 (18:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 2 Apr 2007 22:30:46 +0000 (18:30 -0400)
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" <tytso@mit.edu>
debugfs/ChangeLog
debugfs/dump.c

index d6fd671..6a4de62 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-02  Theodore Tso  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * debugfs.c (do_print_working_directory): Handle the case if
index 577959e..2cfe623 100644 (file)
@@ -5,6 +5,8 @@
  * under the terms of the GNU Public License.
  */
 
+#define _GNU_SOURCE /* for O_LARGEFILE */
+
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -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;