tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
linuxPackages.usbip: fix build with gcc9
Franz Pletz
6 years ago
682de190
8b9b91cc
+41
2 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
usbip
default.nix
fix-strncpy-truncation.patch
+4
pkgs/os-specific/linux/usbip/default.nix
···
8
patches = [
9
# fixes build with gcc8
10
./fix-snprintf-truncation.patch
0
0
11
];
12
13
nativeBuildInputs = [ autoconf automake libtool ];
14
buildInputs = [ udev ];
0
0
15
16
preConfigure = ''
17
cd tools/usb/usbip
···
8
patches = [
9
# fixes build with gcc8
10
./fix-snprintf-truncation.patch
11
+
# fixes build with gcc9
12
+
./fix-strncpy-truncation.patch
13
];
14
15
nativeBuildInputs = [ autoconf automake libtool ];
16
buildInputs = [ udev ];
17
+
18
+
NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
19
20
preConfigure = ''
21
cd tools/usb/usbip
+37
pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/tools/usb/usbip/libsrc/usbip_common.c b/tools/usb/usbip/libsrc/usbip_common.c
2
+
index bb424638d75b..2fc5837e609a 100644
3
+
--- a/tools/usb/usbip/libsrc/usbip_common.c
4
+
+++ b/tools/usb/usbip/libsrc/usbip_common.c
5
+
@@ -226,8 +226,8 @@ int read_usb_device(struct udev_device *sdev, struct usbip_usb_device *udev)
6
+
path = udev_device_get_syspath(sdev);
7
+
name = udev_device_get_sysname(sdev);
8
+
9
+
- strncpy(udev->path, path, SYSFS_PATH_MAX);
10
+
- strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
11
+
+ strncpy(udev->path, path, SYSFS_PATH_MAX-1);
12
+
+ strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE-1);
13
+
14
+
sscanf(name, "%u-%u", &busnum, &devnum);
15
+
udev->busnum = busnum;
16
+
diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
17
+
index 5a3726eb44ab..95b416af8b99 100644
18
+
--- a/tools/usb/usbip/libsrc/usbip_device_driver.c
19
+
+++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
20
+
@@ -91,7 +91,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
21
+
copy_descr_attr16(dev, &descr, idProduct);
22
+
copy_descr_attr16(dev, &descr, bcdDevice);
23
+
24
+
- strncpy(dev->path, path, SYSFS_PATH_MAX);
25
+
+ strncpy(dev->path, path, SYSFS_PATH_MAX-1);
26
+
27
+
dev->speed = USB_SPEED_UNKNOWN;
28
+
speed = udev_device_get_sysattr_value(sdev, "current_speed");
29
+
@@ -110,7 +110,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
30
+
dev->busnum = 0;
31
+
32
+
name = udev_device_get_sysname(plat);
33
+
- strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
34
+
+ strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE-1);
35
+
return 0;
36
+
err:
37
+
fclose(fd);