Skip to contentSkip to conversation

fix check_mntent_file() to pass mode for open(O_CREAT)

PATCH Applied Andreas Dilger 4 participants 5 messages Nov 9, 2007 – Dec 1, 2007 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix check_mntent_file() to pass mode for open(O_CREAT)

On my FC8 install, ismounted.c fails to build because open(O_CREAT) is used without passing a mode. The following trivial patch fixes it.

lib/ext2fs/ismounted.c +1 -1
Index: e2fsprogs-1.40.2/lib/ext2fs/ismounted.c
===================================================================
@@ -147,7 +147,7 @@ static errcode_t check_mntent_file(const
 is_root:
 #define TEST_FILE "/.ismount-test-file"		
 		*mount_flags |= EXT2_MF_ISROOT;
-		fd = open(TEST_FILE, O_RDWR|O_CREAT);
+		fd = open(TEST_FILE, O_RDWR|O_CREAT, 0600);
 		if (fd < 0) {
 			if (errno == EROFS)
 				*mount_flags |= EXT2_MF_READONLY;

Cheers, Andreas
--
Andreas Dilger
Sr. Software Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Andreas Dilger

On my FC8 install, ismounted.c fails to build because open(O_CREAT) is used without passing a mode. The following trivial patch fixes it.

You can add:

'cause it's an awful lot like the patch I sent for the same issue back on 8/16 ;-) Guess I should have followed that up with a ping. (though your 0600 mode is probably better than my 0644 was)

Andreas, did you also run into trouble with struct_io_manager's ->open calls triggering this test?

I sent a patch for that,

[PATCH] rename ->open and ->close ops in struct_io_manager

too... maybe the glibc #define tricks got smarter and don't trigger that now?

-Eric

Quoted 26 lines

Index: e2fsprogs-1.40.2/lib/ext2fs/ismounted.c
===================================================================

lib/ext2fs/ismounted.c +1 -1
@@ -147,7 +147,7 @@ static errcode_t check_mntent_file(const
 is_root:
 #define TEST_FILE "/.ismount-test-file"		
 		*mount_flags |= EXT2_MF_ISROOT;
-		fd = open(TEST_FILE, O_RDWR|O_CREAT);
+		fd = open(TEST_FILE, O_RDWR|O_CREAT, 0600);
 		if (fd < 0) {
 			if (errno == EROFS)
 				*mount_flags |= EXT2_MF_READONLY;

Cheers, Andreas
--
Andreas Dilger
Sr. Software Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 11 lines · Eric Sandeen
Quoted 2 lines · Andreas Dilger

On my FC8 install, ismounted.c fails to build because open(O_CREAT) is used without passing a mode. The following trivial patch fixes it.

You can add:

'cause it's an awful lot like the patch I sent for the same issue back on 8/16 ;-) Guess I should have followed that up with a ping. (though your 0600 mode is probably better than my 0644 was)

Oh, hmm. I'm only testing against 1.40.2, so it is possible your fix got in already... Should have checked that first.

Quoted 2 lines

Andreas, did you also run into trouble with struct_io_manager's ->open calls triggering this test?

No, didn't see any such problems with FC8-test3.

Quoted 31 lines

I sent a patch for that,

[PATCH] rename ->open and ->close ops in struct_io_manager

too... maybe the glibc #define tricks got smarter and don't trigger that now?

-Eric

Quoted 22 lines

Index: e2fsprogs-1.40.2/lib/ext2fs/ismounted.c
===================================================================

lib/ext2fs/ismounted.c +1 -1
@@ -147,7 +147,7 @@ static errcode_t check_mntent_file(const
 is_root:
 #define TEST_FILE "/.ismount-test-file"		
 		*mount_flags |= EXT2_MF_ISROOT;
-		fd = open(TEST_FILE, O_RDWR|O_CREAT);
+		fd = open(TEST_FILE, O_RDWR|O_CREAT, 0600);
 		if (fd < 0) {
 			if (errno == EROFS)
 				*mount_flags |= EXT2_MF_READONLY;

Cheers, Andreas
--
Andreas Dilger
Sr. Software Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

Quoted 9 lines
Quoted 4 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Cheers, Andreas
--
Andreas Dilger
Sr. Software Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 8 lines · Eric Sandeen
Quoted 4 lines · Andreas Dilger

On my FC8 install, ismounted.c fails to build because open(O_CREAT) is used without passing a mode. The following trivial patch fixes it.

Ted, I don't yet see this in the tree, can we make sure this doesn't get lost?

I'm on vacation, but yes, no problem, this will be in the next 1.40.x stable release (which will be going out soon thanks to a security issue that will be going public probably next week).

- Ted

P.S. There will be a press release going out early next week that will explain why I will have a lot more time to work on e2fsprogs in the near future....