[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 126c879: Don't segfault on timed-out TLS connection
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 126c879: Don't segfault on timed-out TLS connections |
Date: |
Tue, 1 Nov 2016 20:00:12 +0000 (UTC) |
branch: master
commit 126c879df42f741fe486236aea538290a8c2ed64
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Don't segfault on timed-out TLS connections
* src/process.c (finish_after_tls_connection): Check that the
file descriptor is still alive before proceeding (bug#24811).
Also clean up the code slightly.
---
src/process.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/process.c b/src/process.c
index 8cf045c..d27b57d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3094,19 +3094,24 @@ finish_after_tls_connection (Lisp_Object proc)
build_string ("The Network Security Manager
stopped the connections")));
deactivate_process (proc);
}
- else
+ else if (p->outfd < 0)
{
- /* If we cleared the connection wait mask before we did
- the TLS setup, then we have to say that the process
- is finally "open" here. */
- if (! FD_ISSET (p->outfd, &connect_wait_mask))
- {
- pset_status (p, Qrun);
- /* Execute the sentinel here. If we had relied on
- status_notify to do it later, it will read input
- from the process before calling the sentinel. */
- exec_sentinel (proc, build_string ("open\n"));
- }
+ /* The counterparty may have closed the connection (especially
+ if the NSM promt above take a long time), so recheck the file
+ descriptor here. */
+ pset_status (p, Qfailed);
+ deactivate_process (proc);
+ }
+ else if (! FD_ISSET (p->outfd, &connect_wait_mask))
+ {
+ /* If we cleared the connection wait mask before we did the TLS
+ setup, then we have to say that the process is finally "open"
+ here. */
+ pset_status (p, Qrun);
+ /* Execute the sentinel here. If we had relied on status_notify
+ to do it later, it will read input from the process before
+ calling the sentinel. */
+ exec_sentinel (proc, build_string ("open\n"));
}
}
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 126c879: Don't segfault on timed-out TLS connections,
Lars Ingebrigtsen <=