summaryrefslogtreecommitdiff
path: root/extras/scsi_id/scsi_serial.c
diff options
context:
space:
mode:
authorpatmans@us.ibm.com <patmans@us.ibm.com>2004-01-16 22:03:50 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:17 -0700
commite996d97835c8d0728a9d4880e9e1f8f285cadf4b (patch)
tree24d013eae9c4a84ee5cbaf3bb28d6270a0bd6cc7 /extras/scsi_id/scsi_serial.c
parenteb7a964a7c66e5aff8147026a60c99258454b612 (diff)
[PATCH] update udev scsi_id to scsi_id 0.3
Diffstat (limited to 'extras/scsi_id/scsi_serial.c')
-rw-r--r--extras/scsi_id/scsi_serial.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c
index 18cd290817..80a1d51635 100644
--- a/extras/scsi_id/scsi_serial.c
+++ b/extras/scsi_id/scsi_serial.c
@@ -385,7 +385,7 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd,
char *buffer, int len)
{
int retval;
- char *vendor;
+ char vendor[MAX_ATTR_LEN];
memset(buffer, 0, len);
retval = scsi_inquiry(scsi_dev, fd, 1, 0x0, buffer, len);
@@ -415,9 +415,10 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd,
* If the vendor id appears in the page assume the page is
* invalid.
*/
- vendor = sysfs_get_attr(scsi_dev, "vendor");
- if (!vendor) {
- log_message(LOG_WARNING, "%s: no vendor attribute\n",
+ if (sysfs_get_attr(scsi_dev->path, "vendor", vendor,
+ MAX_ATTR_LEN)) {
+ log_message(LOG_WARNING,
+ "%s: cannot get model attribute\n",
scsi_dev->name);
return 1;
}
@@ -437,12 +438,11 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd,
static int prepend_vendor_model(struct sysfs_class_device *scsi_dev,
char *serial)
{
- char *attr;
+ char attr[MAX_ATTR_LEN];
int ind;
- attr = sysfs_get_attr(scsi_dev, "vendor");
- if (!attr) {
- log_message(LOG_WARNING, "%s: no vendor attribute\n",
+ if (sysfs_get_attr(scsi_dev->path, "vendor", attr, MAX_ATTR_LEN)) {
+ log_message(LOG_WARNING, "%s: cannot get vendor attribute\n",
scsi_dev->name);
return 1;
}
@@ -454,9 +454,8 @@ static int prepend_vendor_model(struct sysfs_class_device *scsi_dev,
if (serial[ind] == '\n')
serial[ind] = '\0';
- attr = sysfs_get_attr(scsi_dev, "model");
- if (!attr) {
- log_message(LOG_WARNING, "%s: no model attribute\n",
+ if (sysfs_get_attr(scsi_dev->path, "model", attr, MAX_ATTR_LEN)) {
+ log_message(LOG_WARNING, "%s: cannot get model attribute\n",
scsi_dev->name);
return 1;
}