rpasek / usbip-wsl2-instructions

355 stars 37 forks source link

usbip_device_driver.c:108:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation] #7

Open pagkly opened 4 years ago

pagkly commented 4 years ago

how to solve this error 1 when make install the usbip tools?

user@DESKTOP-KDJ7PIR:/usr/src/4.19.84-microsoft-standard/tools/usb/usbip$ sudo make install -j 12
Making install in libsrc
make[1]: Entering directory '/usr/src/4.19.84-microsoft-standard/tools/usb/usbip/libsrc'
  CC       libusbip_la-usbip_device_driver.lo
  CC       libusbip_la-usbip_common.lo
usbip_device_driver.c: In function ‘read_usb_vudc_device’:
usbip_device_driver.c:108:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-tr
uncation]
  108 |  strncpy(dev->path, path, SYSFS_PATH_MAX);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usbip_device_driver.c:127:2: error: ‘strncpy’ specified bound 32 equals destination size [-Werror=stringop-tru
ncation]
  127 |  strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:472: libusbip_la-usbip_device_driver.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
usbip_common.c: In function ‘read_usb_device’:
usbip_common.c:229:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncatio
n]
  229 |  strncpy(udev->path,  path,  SYSFS_PATH_MAX);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usbip_common.c:230:2: error: ‘strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncatio
]
  230 |  strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:479: libusbip_la-usbip_common.lo] Error 1
make[1]: Leaving directory '/usr/src/4.19.84-microsoft-standard/tools/usb/usbip/libsrc'
make: *** [Makefile:498: install-recursive] Error 1

thank you

n3rd4i commented 4 years ago

I've removed the -Werror before running the actual make in files:

dkozel commented 4 years ago

Fixed by the patches in https://github.com/rpasek/usbip-wsl2-instructions/pull/15