[Pcsclite-git-commit] [PCSC] 01/02: hotplug_libudev.c: fix compiler warnings
Ludovic Rousseau
rousseau at moszumanska.debian.org
Thu Aug 27 15:21:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit 7eba88330cd4fad6b95cd6f49fe30df435d560cb
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Thu Aug 27 11:21:14 2015 +0200
hotplug_libudev.c: fix compiler warnings
hotplug_libudev.c: In function ‘HPAddDevice’:
hotplug_libudev.c:443:2: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf(&deviceName, "usb:%04x/%04x:libudev:%d:%s",
^
hotplug_libudev.c:475:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf(&result, "%s [%s]", fullname, sInterfaceName);
^
hotplug_libudev.c:491:4: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf(&result, "%s (%s)", fullname, sSerialNumber);
^
Check the value returned by asprintf(3) and exit if it fails.
---
src/hotplug_libudev.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/hotplug_libudev.c b/src/hotplug_libudev.c
index fd077dc..8a7d30c 100644
--- a/src/hotplug_libudev.c
+++ b/src/hotplug_libudev.c
@@ -440,8 +440,13 @@ static void HPAddDevice(struct udev_device *dev)
else
bInterfaceNumber = 0;
- asprintf(&deviceName, "usb:%04x/%04x:libudev:%d:%s",
+ i = asprintf(&deviceName, "usb:%04x/%04x:libudev:%d:%s",
driver->manuID, driver->productID, bInterfaceNumber, devpath);
+ if (-1 == i)
+ {
+ Log1(PCSC_LOG_ERROR, "asprintf() failed");
+ return;
+ }
/* find a free entry */
for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
@@ -472,7 +477,12 @@ static void HPAddDevice(struct udev_device *dev)
char *result;
/* create a new name */
- asprintf(&result, "%s [%s]", fullname, sInterfaceName);
+ i= asprintf(&result, "%s [%s]", fullname, sInterfaceName);
+ if (-1 == i)
+ {
+ Log1(PCSC_LOG_ERROR, "asprintf() failed");
+ goto exit;
+ }
free(fullname);
fullname = result;
@@ -488,7 +498,12 @@ static void HPAddDevice(struct udev_device *dev)
char *result;
/* create a new name */
- asprintf(&result, "%s (%s)", fullname, sSerialNumber);
+ i = asprintf(&result, "%s (%s)", fullname, sSerialNumber);
+ if (-1 == i)
+ {
+ Log1(PCSC_LOG_ERROR, "asprintf() failed");
+ goto exit;
+ }
free(fullname);
fullname = result;
@@ -524,6 +539,7 @@ static void HPAddDevice(struct udev_device *dev)
}
}
+exit:
free(fullname);
free(deviceName);
} /* HPAddDevice */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git
More information about the Pcsclite-cvs-commit
mailing list