Skip to contentSkip to conversation

create_floppy_devices modifying mode via umask

PATCH In review Matthias Schwarzott 2 participants 4 messages Mar 5, 2007 – Mar 8, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 create_floppy_devices modifying mode via umask

Hi Kay, hi List!

This one line patch against udev-106 adds umask(0) call to create_floppy_devices to change inherited umask of 022 (from udevd) which was restricting group write permissions for the created device nodes for our rules (using -M 0660).

Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
extras/floppy/create_floppy_devices.c +2 -0
index 7b61ef0..187324e 100644
@@ -155,6 +155,8 @@ int main(int argc, char **argv)
 	if (type == 0)
 		return 0;
 
+	umask(0);
+
 	selinux_init();
 
 	i = 0;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · Matthias Schwarzott

This one line patch against udev-106 adds umask(0) call to create_floppy_devices to change inherited umask of 022 (from udevd) which was restricting group write permissions for the created device nodes for our rules (using -M 0660).

How about explicit chmod(), like we do in udev, instead? Does that work for you?

Thanks,
Kay

extras/floppy/create_floppy_devices.c +3 -2
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
 	int major = 2, minor;
 	uid_t uid = 0;
 	gid_t gid = 0;
-	mode_t mode = 0;
+	mode_t mode = 0660;
 	int create_nodes = 0;
 	int print_nodes = 0;
 	int unlink_nodes = 0;
@@ -165,10 +165,11 @@ int main(int argc, char **argv)
 			printf("%s b %d %d %d\n", node, mode, major, minor);
 		if (create_nodes) {
 			unlink(node);
-			selinux_setfscreatecon(node, NULL, mode);
+			selinux_setfscreatecon(node, NULL, S_IFBLK | mode);
 			mknod(node, S_IFBLK | mode, makedev(major,minor));
 			selinux_resetfscreatecon();
 			chown(node, uid, gid);
+			chmod(node, S_IFBLK | mode);
 		}
 		i++;
 	}

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Matthias Schwarzott
Quoted 8 lines · Kay Sievers
Quoted 4 lines · Matthias Schwarzott

This one line patch against udev-106 adds umask(0) call to create_floppy_devices to change inherited umask of 022 (from udevd) which was restricting group write permissions for the created device nodes for our rules (using -M 0660).

How about explicit chmod(), like we do in udev, instead? Does that work for you?

That works for me.

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Matthias Schwarzott
Quoted 11 lines · Matthias Schwarzott
Quoted 8 lines · Kay Sievers
Quoted 4 lines · Matthias Schwarzott

This one line patch against udev-106 adds umask(0) call to create_floppy_devices to change inherited umask of 022 (from udevd) which was restricting group write permissions for the created device nodes for our rules (using -M 0660).

How about explicit chmod(), like we do in udev, instead? Does that work for you?

That works for me.

I've committed that now.

Thanks,
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel