Browse Source

Make wpa_ctrl_close() handle unopened connection

Dmitry Shmidt 14 years ago
parent
commit
36fde1e79c
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/common/wpa_ctrl.c

+ 4 - 1
src/common/wpa_ctrl.c

@@ -127,8 +127,11 @@ try_again:
 
 void wpa_ctrl_close(struct wpa_ctrl *ctrl)
 {
+	if (ctrl == NULL)
+		return;
 	unlink(ctrl->local.sun_path);
-	close(ctrl->s);
+	if (ctrl->s >= 0)
+		close(ctrl->s);
 	os_free(ctrl);
 }