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" <tytso@mit.edu>
#define _GNU_SOURCE /* for O_DIRECT */
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_GETOPT_H
unsigned int (*test_func)(int, blk_t,
int, blk_t,
unsigned int);
- int open_flag = 0;
+ int open_flag;
long sysval;
setbuf(stdout, NULL);
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"),