summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorJohn Hull <john_hull@dell.com>2005-09-16 21:10:12 +0200
committerKay Sievers <kay.sievers@suse.de>2005-09-16 21:10:12 +0200
commit4b12433517bfb1a4cdf4eecc5102f2cc5e1e6288 (patch)
tree9539742e2902528b65d3eda59d2aa93d89b2d3c5 /extras
parent77914dfeda9caae155f7dcdbeb06dc8574a6f4ad (diff)
edd_id: check that EDD id is unique
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. Signed-off-by: John Hull <john_hull@dell.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/edd_id/edd_id.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c
index 504aac36e6..8ac50e9812 100644
--- a/extras/edd_id/edd_id.c
+++ b/extras/edd_id/edd_id.c
@@ -63,6 +63,7 @@ int main(int argc, char *argv[])
int sysfs_fd;
DIR *dir = NULL;
int rc = 1;
+ char *match = NULL;
logging_init("edd_id");
@@ -165,14 +166,23 @@ int main(int argc, char *argv[])
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);