]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
linux: reverse size/nmemb in fread calls so that we return the number of chars that... master
authorBrice Goglin <Brice.Goglin@inria.fr>
Fri, 14 Feb 2014 08:35:16 +0000 (09:35 +0100)
committerBrice Goglin <Brice.Goglin@inria.fr>
Fri, 14 Feb 2014 08:35:16 +0000 (09:35 +0100)
src/topology-linux.c
src/topology-pci.c

index fd7dd30fc266be9e8bb081d6ebff4cb8b11cb70c..a5235cea2c249347824e45b6f65454c6f1b5bf35 100644 (file)
@@ -4708,7 +4708,7 @@ hwloc_look_linuxfs_pci(struct hwloc_backend *backend)
     snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/vendor", dirent->d_name);
     file = hwloc_fopen(path, "r", root_fd);
     if (file) {
-      read = fread(value, sizeof(value), 1, file);
+      read = fread(value, 1, sizeof(value), file);
       fclose(file);
       if (read)
         attr->vendor_id = strtoul(value, NULL, 16);
@@ -4716,7 +4716,7 @@ hwloc_look_linuxfs_pci(struct hwloc_backend *backend)
     snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/device", dirent->d_name);
     file = hwloc_fopen(path, "r", root_fd);
     if (file) {
-      read = fread(value, sizeof(value), 1, file);
+      read = fread(value, 1, sizeof(value), file);
       fclose(file);
       if (read)
         attr->device_id = strtoul(value, NULL, 16);
@@ -4724,7 +4724,7 @@ hwloc_look_linuxfs_pci(struct hwloc_backend *backend)
     snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/class", dirent->d_name);
     file = hwloc_fopen(path, "r", root_fd);
     if (file) {
-      read = fread(value, sizeof(value), 1, file);
+      read = fread(value, 1, sizeof(value), file);
       fclose(file);
       if (read)
         attr->class_id = strtoul(value, NULL, 16) >> 8;
@@ -4732,7 +4732,7 @@ hwloc_look_linuxfs_pci(struct hwloc_backend *backend)
     snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/subsystem_vendor", dirent->d_name);
     file = hwloc_fopen(path, "r", root_fd);
     if (file) {
-      read = fread(value, sizeof(value), 1, file);
+      read = fread(value, 1, sizeof(value), file);
       fclose(file);
       if (read)
         attr->subvendor_id = strtoul(value, NULL, 16);
@@ -4740,7 +4740,7 @@ hwloc_look_linuxfs_pci(struct hwloc_backend *backend)
     snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/subsystem_device", dirent->d_name);
     file = hwloc_fopen(path, "r", root_fd);
     if (file) {
-      read = fread(value, sizeof(value), 1, file);
+      read = fread(value, 1, sizeof(value), file);
       fclose(file);
       if (read)
         attr->subdevice_id = strtoul(value, NULL, 16);
index aa366c762b2cbe74dea290de33462a610be74d4e..eaf6da215f8f29265475437e6de8947a9d0648dd 100644 (file)
@@ -255,7 +255,7 @@ hwloc_look_pci(struct hwloc_backend *backend)
               domain, pcidev->bus, pcidev->dev, pcidev->func);
       file = fopen(path, "r");
       if (file) {
-       read = fread(value, sizeof(value), 1, file);
+       read = fread(value, 1, sizeof(value), file);
        fclose(file);
        if (read)
          obj->attr->pcidev.vendor_id = strtoul(value, NULL, 16);
@@ -265,7 +265,7 @@ hwloc_look_pci(struct hwloc_backend *backend)
               domain, pcidev->bus, pcidev->dev, pcidev->func);
       file = fopen(path, "r");
       if (file) {
-       read = fread(value, sizeof(value), 1, file);
+       read = fread(value, 1, sizeof(value), file);
        fclose(file);
        if (read)
          obj->attr->pcidev.device_id = strtoul(value, NULL, 16);