summaryrefslogtreecommitdiff
path: root/extras/volume_id/volume_id.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-05-12 00:52:52 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:17 -0700
commitcde5a756ce10530136b8d387346c48260a69dbfb (patch)
tree332d0d499fdad63e5b9ed57e8364e0fe9dcc2a0f /extras/volume_id/volume_id.c
parent7f639ff99e3857870e4e0f41843dff7ad48ad784 (diff)
[PATCH] udev_volume_id update
Here is a update to extras/volume_id/* o The device is now specified by the DEVPATH in the environment, it's no longer needed to pass the major/minor to the callout. o leading spaces and slashes are now removed from the returned string and spaces are replaced by underscore, to not to confuse udev. o Arnd Bergmann <arnd@arndb.de> provided the code to recognize s390 dasd disk labels. The -d switch tries to read the main block device instead of the partition.
Diffstat (limited to 'extras/volume_id/volume_id.c')
-rw-r--r--extras/volume_id/volume_id.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c
index 8eba4b22f2..dcc341c4dd 100644
--- a/extras/volume_id/volume_id.c
+++ b/extras/volume_id/volume_id.c
@@ -82,7 +82,7 @@ static void set_label_string(struct volume_id *id, char *buf, int count)
memcpy(id->label_string, buf, count);
/* remove trailing whitespace */
- i = strlen(id->label_string);
+ i = strnlen(id->label_string, count);
while (i--) {
if (! isspace(id->label_string[i]))
break;
@@ -839,10 +839,11 @@ struct volume_id *volume_id_open_dev_t(dev_t devt)
char tmp_node[VOLUME_ID_PATH_MAX];
snprintf(tmp_node, VOLUME_ID_PATH_MAX,
- "/tmp/volume-%u-%u", major(devt), minor(devt));
+ "/tmp/volume-%u-%u-%u", getpid(), major(devt), minor(devt));
tmp_node[VOLUME_ID_PATH_MAX] = '\0';
/* create tempory node to open the block device */
+ unlink(tmp_node);
if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0)
return NULL;