summaryrefslogtreecommitdiffstats
path: root/e2fsprogs-1.42.10-largefile.patch
blob: 5a4c232a84663edeb3615a9fcb097ea4e7c93d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[PATCH] mke2fs: use ext2fs_open_file() in check_plausibility()

The commit:

802146c mke2fs: create a regular file if necessary

caused a regression on 32-bit machines; the open() fails if
the file size is > 4G.

Using ext2fs_open_file() fixes it.

Resolves: Red Hat Bugzilla #1099892

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: against master!  Sorry, first patch was against the
bisection point.

TBH I don't know if this should be using ext2fs_open_file(),
or some other magic like O_LARGEFILE, but this works for me,
and we use the stat/fstat wrapper here too, so ...

diff --git a/misc/util.c b/misc/util.c
index 1c0818f..9475fc6 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -194,10 +194,10 @@ int check_plausibility(const char *device, int flags, int *ret_is_dev)
 	char *fs_type = NULL;
 	char *fs_label = NULL;
 
-	fd = open(device, fl, 0666);
+	fd = ext2fs_open_file(device, fl, 0666);
 	if ((fd < 0) && (errno == ENOENT) && (flags & CREATE_FILE)) {
 		fl |= O_CREAT;
-		fd = open(device, fl, 0666);
+		fd = ext2fs_open_file(device, fl, 0666);
 		if (fd >= 0 && (flags & VERBOSE_CREATE))
 			printf(_("Creating regular file %s\n"), device);
 	}