aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-06-14 05:12:59 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-06-26 02:11:33 +0200
commit4412cad28a7619330f83974a15d512e5c37e8eb5 (patch)
tree96f898f4b7bcb63c7da3a707b9b6cb35dd2b32cd
parent2fd9bea7128d8ee43b4048552bc673c4cd4210e4 (diff)
downloadhardware_replicant_libsamsung-ipc-4412cad28a7619330f83974a15d512e5c37e8eb5.tar.gz
hardware_replicant_libsamsung-ipc-4412cad28a7619330f83974a15d512e5c37e8eb5.tar.bz2
hardware_replicant_libsamsung-ipc-4412cad28a7619330f83974a15d512e5c37e8eb5.zip
crespo_gprs_get_iface_single: handle asprintf errors
Without that fix we have the following warning: ../../../samsung-ipc/devices/crespo/crespo.c: In function 'crespo_gprs_get_iface_single': ../../../samsung-ipc/devices/crespo/crespo.c:562:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result] 562 | asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--samsung-ipc/devices/crespo/crespo.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c
index ebb6075..27e1dd5 100644
--- a/samsung-ipc/devices/crespo/crespo.c
+++ b/samsung-ipc/devices/crespo/crespo.c
@@ -553,13 +553,17 @@ int crespo_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
return 0;
}
-char *crespo_gprs_get_iface_single(
- __attribute__((unused)) struct ipc_client *client,
- __attribute__((unused)) unsigned int cid)
+char *crespo_gprs_get_iface_single(struct ipc_client *client,
+ __attribute__((unused)) unsigned int cid)
{
char *iface = NULL;
+ int rc;
- asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0);
+ rc = asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0);
+ if (rc == -1) {
+ ipc_client_log(client, "%s: asprintf failed", __func__);
+ return NULL;
+ }
return iface;
}