From b495d6c747b0d9c9626cd84826b91b787065ca07 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Sun, 13 Dec 2020 00:46:46 +0100 Subject: [PATCH] gpio: get rid of compiler warnings --- src/manager.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/manager.c b/src/manager.c index 739a8f0..bc90985 100644 --- a/src/manager.c +++ b/src/manager.c @@ -112,18 +112,23 @@ void modem_configure(struct EG25Manager *manager) void modem_reset(struct EG25Manager *manager) { - int fd; + int fd, ret, len = strlen(manager->modem_usb_id); fd = open("/sys/bus/usb/drivers/usb/unbind", O_WRONLY); if (fd < 0) goto error; - write(fd, manager->modem_usb_id, strlen(manager->modem_usb_id)); + ret = write(fd, manager->modem_usb_id, len); + if (ret < len) + g_warning("Couldn't unbind modem: wrote %d/%d bytes", ret, len); close(fd); fd = open("/sys/bus/usb/drivers/usb/bind", O_WRONLY); if (fd < 0) goto error; - write(fd, manager->modem_usb_id, strlen(manager->modem_usb_id)); + ret = write(fd, manager->modem_usb_id, len); + if (ret < len) + g_warning("Couldn't unbind modem: wrote %d/%d bytes", ret, len); + close(fd); return;