* [PATCH] extras/edd_id/edd_id.c: unique signature check
@ 2005-09-08 17:54 John_Hull
2005-09-08 18:31 ` Kay Sievers
0 siblings, 1 reply; 2+ messages in thread
From: John_Hull @ 2005-09-08 17:54 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
The attached patch adds a check to edd_id.c to verify that the MBR
signature on the device node passed to the program is unique to only
that disk. If the signature is not unique, the program will print an
error to the screen and exit.
Please review.
Signed-off-by: John Hull <john_hull@dell.com>
John A. Hull
Linux Solutions Development
Dell Inc.
[-- Attachment #2: edd-unique-sig.patch --]
[-- Type: application/octet-stream, Size: 810 bytes --]
--- a/extras/edd_id/edd_id.c.orig 2005-09-08 18:50:01.000000000 -0500
+++ a/extras/edd_id/edd_id.c 2005-09-08 18:37:41.000000000 -0500
@@ -63,6 +63,7 @@
int sysfs_fd;
DIR *dir = NULL;
int rc = 1;
+ char *match = NULL;
logging_init("edd_id");
@@ -165,14 +166,23 @@
sysfs_id = strtoul(sysfs_id_buf, NULL, 16);
if (disk_id == sysfs_id) {
+ if (!match) {
+ match = dent->d_name;
+ } else {
+ info("'%s' does not have a unique signature", node);
+ fprintf(stderr, "'%s' does not have a unique signature\n", node);
+ rc=10;
+ goto exit;
+ }
+ }
+
+ }
+
if (export)
- printf("ID_EDD=%s\n", dent->d_name);
+ printf("ID_EDD=%s\n", match);
else
- printf("%s\n", dent->d_name);
+ printf("%s\n", match);
rc = 0;
- break;
- }
- }
close:
close(disk_fd);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-08 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-08 17:54 [PATCH] extras/edd_id/edd_id.c: unique signature check John_Hull
2005-09-08 18:31 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).