aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2016-07-21 11:27:55 +0200
committerPaul Eggert2016-07-21 11:29:43 +0200
commita066fb1ceee373c982214c28206108c5fba01bf7 (patch)
tree4a5dc8677580fdf51c485ad53641948af0c17850 /src
parent9eb028f886858d6cb2a92063f5ea01c2f4b7d584 (diff)
downloademacs-a066fb1ceee373c982214c28206108c5fba01bf7.tar.gz
emacs-a066fb1ceee373c982214c28206108c5fba01bf7.zip
Fix use-after-close in connect_network_socket
* src/process.c (connect_network_socket): Don’t use external_sock_fd after closing it. Problem found by Coverity Scan.
Diffstat (limited to 'src')
-rw-r--r--src/process.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c
index bdbdefabb64..bc2ac451c9d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3185,6 +3185,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
3185 xerrno = errno; 3185 xerrno = errno;
3186 emacs_close (s); 3186 emacs_close (s);
3187 s = -1; 3187 s = -1;
3188 if (socket_to_use < 0)
3189 break;
3188 continue; 3190 continue;
3189 } 3191 }
3190 } 3192 }
@@ -3312,6 +3314,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
3312 specpdl_ptr = specpdl + count1; 3314 specpdl_ptr = specpdl + count1;
3313 emacs_close (s); 3315 emacs_close (s);
3314 s = -1; 3316 s = -1;
3317 if (socket_to_use < 0)
3318 break;
3315 3319
3316#ifdef WINDOWSNT 3320#ifdef WINDOWSNT
3317 if (xerrno == EINTR) 3321 if (xerrno == EINTR)