From 22301afb01f3059a2b1baf68abff26aaf6db7c9e Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 2 Sep 2008 08:29:20 -0400 Subject: [PATCH] badblocks: Open the device with O_LARGEFILE Linux doesn't enforce the Large File Support API requirements on block devices, but in case someone wants to run badblocks on a normal file, open the device file with O_LARGEFILE. Signed-off-by: "Theodore Ts'o" --- misc/badblocks.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/misc/badblocks.c b/misc/badblocks.c index 6261cbe..1d0f95a 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -31,6 +31,10 @@ #define _GNU_SOURCE /* for O_DIRECT */ +#ifndef O_LARGEFILE +#define O_LARGEFILE 0 +#endif + #include #include #ifdef HAVE_GETOPT_H @@ -933,7 +937,7 @@ int main (int argc, char ** argv) unsigned int (*test_func)(int, blk_t, int, blk_t, unsigned int); - int open_flag = 0; + int open_flag; long sysval; setbuf(stdout, NULL); @@ -1096,7 +1100,7 @@ int main (int argc, char ** argv) if (w_flag) check_mount(device_name); - open_flag = w_flag ? O_RDWR : O_RDONLY; + open_flag = O_LARGEFILE | (w_flag ? O_RDWR : O_RDONLY); dev = open (device_name, open_flag); if (dev == -1) { com_err (program_name, errno, _("while trying to open %s"), -- 1.8.3.1