aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-28 15:45:20 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-28 15:45:20 +0000
commitb4e237aae774a6dd3de2c3db9f87012d48ab6716 (patch)
tree8c7c82d0eab005a341eba3b217b5d7ef95774d63 /usb-linux.c
parentFix -Werror=format-security warning (Frederik Himpe/Lennert Buytenhek) (diff)
downloadqemu-kvm-b4e237aae774a6dd3de2c3db9f87012d48ab6716.tar.gz
qemu-kvm-b4e237aae774a6dd3de2c3db9f87012d48ab6716.tar.bz2
qemu-kvm-b4e237aae774a6dd3de2c3db9f87012d48ab6716.zip
Suppress a -Werror=format-security warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6135 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'usb-linux.c')
-rw-r--r--usb-linux.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usb-linux.c b/usb-linux.c
index 334b45d30..fb1153bbd 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1163,7 +1163,8 @@ static int usb_host_read_file(char *line, size_t line_size, const char *device_f
int ret = 0;
char filename[PATH_MAX];
- snprintf(filename, PATH_MAX, device_file, device_name);
+ snprintf(filename, PATH_MAX, USBSYSBUS_PATH "/devices/%s/%s", device_name,
+ device_file);
f = fopen(filename, "r");
if (f) {
fgets(line, line_size, f);
@@ -1205,27 +1206,30 @@ static int usb_host_scan_sys(void *opaque, USBScanFunc *func)
tmpstr += 3;
bus_num = atoi(tmpstr);
- if (!usb_host_read_file(line, sizeof(line), USBSYSBUS_PATH "/devices/%s/devnum", de->d_name))
+ if (!usb_host_read_file(line, sizeof(line), "devnum", de->d_name))
goto the_end;
if (sscanf(line, "%d", &addr) != 1)
goto the_end;
- if (!usb_host_read_file(line, sizeof(line), USBSYSBUS_PATH "/devices/%s/bDeviceClass", de->d_name))
+ if (!usb_host_read_file(line, sizeof(line), "bDeviceClass",
+ de->d_name))
goto the_end;
if (sscanf(line, "%x", &class_id) != 1)
goto the_end;
- if (!usb_host_read_file(line, sizeof(line), USBSYSBUS_PATH "/devices/%s/idVendor", de->d_name))
+ if (!usb_host_read_file(line, sizeof(line), "idVendor", de->d_name))
goto the_end;
if (sscanf(line, "%x", &vendor_id) != 1)
goto the_end;
- if (!usb_host_read_file(line, sizeof(line), USBSYSBUS_PATH "/devices/%s/idProduct", de->d_name))
+ if (!usb_host_read_file(line, sizeof(line), "idProduct",
+ de->d_name))
goto the_end;
if (sscanf(line, "%x", &product_id) != 1)
goto the_end;
- if (!usb_host_read_file(line, sizeof(line), USBSYSBUS_PATH "/devices/%s/product", de->d_name)) {
+ if (!usb_host_read_file(line, sizeof(line), "product",
+ de->d_name)) {
*product_name = 0;
} else {
if (strlen(line) > 0)
@@ -1233,7 +1237,7 @@ static int usb_host_scan_sys(void *opaque, USBScanFunc *func)
pstrcpy(product_name, sizeof(product_name), line);
}
- if (!usb_host_read_file(line, sizeof(line), USBSYSBUS_PATH "/devices/%s/speed", de->d_name))
+ if (!usb_host_read_file(line, sizeof(line), "speed", de->d_name))
goto the_end;
if (!strcmp(line, "480\n"))
speed = USB_SPEED_HIGH;