udev-133: another patch (create_floppy_devices) [Was: Re: udev-133: build failure and 3 small patches]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

You have reacted promptly to my previous mail, but not to the most recent
one.  The subject didn't make clear that this was an additional patch
(avoiding some problems in create_floppy_devices, including a potential
segfault).  Thus I suspect you took my msg as a followup of the first one.

Here that mail once again with a modified subject.

Regards,
Peter Breitenlohner <peb@xxxxxxxxxxxx>

---------- Forwarded message ----------
Date: Sun, 23 Nov 2008 15:39:04 +0100 (CET)
From: Peter Breitenlohner <peb@xxxxxxxxxxxx>
To: Kay Sievers <kay.sievers@xxxxxxxx>
Cc: linux-hotplug@xxxxxxxxxxxxxxx
Subject: Re: udev-133: build failure and 3 small patches

On Fri, 21 Nov 2008, Kay Sievers wrote:

The first one fixes a build problem (!HAVE_INOTIFY needs <errno.h>).

That was already fixed in the git tree.

The other two correct minor manpage typos.

Applied.

Attached is an additional patch that fixes some bugs in
create_floppy_devices.

Regards,
Peter Breitenlohner <peb@xxxxxxxxxxxx>
	Fix off-by-4 bug in floppy minors for fd[4-7].

	Avoid segmentation fault for bad CMOS type.

	Print mode in human readable, i.e., octal form.

diff -ur udev-133.orig/extras/floppy/create_floppy_devices.c udev-133/extras/floppy/create_floppy_devices.c
--- udev-133.orig/extras/floppy/create_floppy_devices.c	2008-10-18 19:45:26.000000000 +0200
+++ udev-133/extras/floppy/create_floppy_devices.c	2008-11-22 23:36:52.000000000 +0100
@@ -130,14 +130,14 @@
 		return 1;
 	}
 	if (fdnum > 3)
-		fdnum += 128;
+		fdnum += 124;
 
 	if (major < 1) {
 		fprintf(stderr,"Invalid major number %d\n", major);
 		return 1;
 	}
 
-	if (type < 0 || type > (int) sizeof(table)) {
+	if (type < 0 || type >= (int) (sizeof(table_sup) / sizeof(table_sup[0]))) {
 		fprintf(stderr,"Invalid CMOS type %d\n", type);
 		return 1;
 	}
@@ -150,7 +150,7 @@
 		sprintf(node, "%s%s", dev, table[table_sup[type][i]]);
 		minor = (table_sup[type][i] << 2) + fdnum;
 		if (print_nodes)
-			printf("%s b %d %d %d\n", node, mode, major, minor);
+			printf("%s b %.4o %d %d\n", node, mode, major, minor);
 		if (create_nodes) {
 			unlink(node);
 			udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode);

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux