Skip to contentSkip to conversation

Tools: hv: check return value of system in hv_kvp_daemon

PATCH In review Olaf Hering 3 participants 3 messages Aug 1, 2013 – Aug 2, 2013 Hyper-V/Azure core and drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Tools: hv: check return value of system in hv_kvp_daemon

hv_kvp_daemon.c: In function 'main':
hv_kvp_daemon.c:1441:8: warning: ignoring return value of 'daemon', declared with attribute warn_unused_result [-Wunused-result]

---
 tools/hv/hv_kvp_daemon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/hv/hv_kvp_daemon.c +5 -1
index ba075e5..b96eccc 100644
@@ -1353,7 +1353,11 @@ setval_done:
 	 */
 
 	snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file);
-	system(cmd);
+	if (system(cmd)) {
+		syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
+				cmd, errno, strerror(errno));
+		return HV_E_FAIL;
+	}
 	return 0;
 
 setval_error:
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, August 01, 2013 9:04 AM
To: KY Srinivasan; [email protected]
Cc: [email protected]; Olaf Hering
Subject: [PATCH] Tools: hv: check return value of system in hv_kvp_daemon

Quoted 5 lines

hv_kvp_daemon.c: In function 'main':
hv_kvp_daemon.c:1441:8: warning: ignoring return value of 'daemon', declared with attribute warn_unused_result [-Wunused-result]

Quoted 23 lines
---
 tools/hv/hv_kvp_daemon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/hv/hv_kvp_daemon.c +5 -1
index ba075e5..b96eccc 100644
@@ -1353,7 +1353,11 @@ setval_done:
 	 */
 
 	snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file);
-	system(cmd);
+	if (system(cmd)) {
+		syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
+				cmd, errno, strerror(errno));
+		return HV_E_FAIL;
+	}
 	return 0;
 
 setval_error:
#2 lore raw
Quoted 9 lines · KY Srinivasan
Quoted 9 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, August 01, 2013 9:04 AM
To: KY Srinivasan; [email protected]
Cc: [email protected]; Olaf Hering
Subject: [PATCH] Tools: hv: check return value of system in hv_kvp_daemon

Quoted 6 lines
Quoted 5 lines

hv_kvp_daemon.c: In function 'main':
hv_kvp_daemon.c:1441:8: warning: ignoring return value of 'daemon', declared with attribute warn_unused_result [-Wunused-result]

Can you please resend this to me, I don't seem to have a copy of it anywhere.

thanks,

greg k-h