On Sunday, December 8, 2019 at 10:32:54 PM UTC-8, liuzhiqiang (I) wrote:
In find_vlan_dev func, socket should be checked before used. 

Signed-off-by: Zhiqiang Liu <[email protected]> 
--- 
usr/iscsi_net_util.c | 4 ++++ 
1 file changed, 4 insertions(+) 

diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c 
index b5a910f..c38456f 100644 
--- a/usr/iscsi_net_util.c 
+++ b/usr/iscsi_net_util.c 
@@ -192,6 +192,10 @@ static char *find_vlan_dev(char *netdev, int vlan_id) 
{ 
int sockfd, i, rc; 

sockfd = socket(AF_INET, SOCK_DGRAM, 0); 
+ if (sockfd < 0) { 
+ log_error("Could not open socket for ioctl."); 
+ return NULL; 
+ } 

strlcpy(if_hwaddr.ifr_name, netdev, IFNAMSIZ); 
ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr); 
-- 
2.24.0.windows.2 

Reviewed-by: Lee Duncan <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/28683699-a9e8-44e7-be9e-d0bbb4057dc8%40googlegroups.com.

Reply via email to