From: Luca Boccassi Date: Thu, 8 Feb 2024 10:22:15 +0000 (+0000) Subject: fix new compiler warnings X-Git-Tag: archive/raspbian/3.2.1-31+rpi1~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=183f94ddb47a19071c5e61fa14a24d410795976f;p=bumblebee.git fix new compiler warnings Forwarded: https://github.com/Bumblebee-Project/Bumblebee/pull/1071 Gbp-Pq: Name compiler-warnings.patch --- diff --git a/src/bbsecondary.c b/src/bbsecondary.c index 11520b8..c71dc3b 100644 --- a/src/bbsecondary.c +++ b/src/bbsecondary.c @@ -139,10 +139,10 @@ bool start_secondary(bool need_secondary) { return true; //no problems, start X if not started yet if (!bb_is_running(bb_status.x_pid)) { - char pci_id[13]; + char pci_id[16]; static char *x_conf_file; // 0-255 bus, 0-31 slot, 0-7 func - snprintf(pci_id, 13, "PCI:%03d:%02d:%o", pci_bus_id_discrete->bus, + snprintf(pci_id, 16, "PCI:%03d:%02d:%o", pci_bus_id_discrete->bus, pci_bus_id_discrete->slot, pci_bus_id_discrete->func); if (!x_conf_file) { x_conf_file = xorg_path_w_driver(bb_config.x_conf_file, bb_config.driver); diff --git a/src/pci.c b/src/pci.c index d26c24a..fa77fff 100644 --- a/src/pci.c +++ b/src/pci.c @@ -54,7 +54,7 @@ int pci_parse_bus_id(struct pci_bus_id *dest, int bus_id_numeric) { */ int pci_get_class(struct pci_bus_id *bus_id) { /* the Bus ID is always of fixed length */ - char class_path[40]; + char class_path[42]; FILE *fp; snprintf(class_path, sizeof class_path, @@ -133,7 +133,7 @@ struct pci_bus_id *pci_find_gfx_by_vendor(unsigned int vendor_id, unsigned int i * buffer was too small) or 0 on error */ size_t pci_get_driver(char *dest, struct pci_bus_id *bus_id, size_t len) { - char path[1024]; + char path[1024], resolved_path[1024]; ssize_t read_bytes; char *name; @@ -145,16 +145,16 @@ size_t pci_get_driver(char *dest, struct pci_bus_id *bus_id, size_t len) { /* the path to the driver if one is loaded */ snprintf(path, sizeof path, "/sys/bus/pci/devices/0000:%02x:%02x.%o/driver", bus_id->bus, bus_id->slot, bus_id->func); - read_bytes = readlink(path, path, sizeof(path) - 1); + read_bytes = readlink(path, resolved_path, sizeof(resolved_path) - 1); if (read_bytes < 0) { /* error, assume that the driver is not loaded */ return 0; } /* readlink does not append a NULL according to the manpage */ - path[read_bytes] = 0; + resolved_path[read_bytes] = 0; - name = basename(path); + name = basename(resolved_path); /* save the name if a valid destination and buffer size was given */ if (dest && len > 0) { strncpy(dest, name, len - 1); @@ -172,7 +172,7 @@ size_t pci_get_driver(char *dest, struct pci_bus_id *bus_id, size_t len) { * @return a file handle on success, or NULL on failure */ static int pci_config_open(struct pci_bus_id *bus_id, mode_t mode) { - char config_path[41]; + char config_path[43]; snprintf(config_path, sizeof config_path, "/sys/bus/pci/devices/0000:%02x:%02x.%o/config", bus_id->bus,