blob: 79620039db93cfa53afe9187a22d6efd951b560f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#! /bin/sh /usr/share/dpatch/dpatch-run
## rlfe-history.dpatch by <andrew@pimlott.net>
##
## DP: Fix rlfe, always writing a history file.
@DPATCH@
--- a/examples/rlfe/rlfe.c
+++ b/examples/rlfe/rlfe.c
@@ -154,21 +154,27 @@ struct termios orig_term;
static pid_t child = -1;
static void
-sig_child (int signo)
+finish_up()
{
- int status;
- wait (&status);
if (hist_file != 0)
{
write_history (hist_file);
if (hist_size)
history_truncate_file (hist_file, hist_size);
}
- DPRINT0 ("(Child process died.)\n");
tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
exit (0);
}
+static void
+sig_child (int signo)
+{
+ int status;
+ wait (&status);
+ DPRINT0 ("(Child process died.)\n");
+ finish_up();
+}
+
volatile int propagate_sigwinch = 0;
/* sigwinch_handler
@@ -710,8 +716,7 @@ main(int argc, char** argv)
if (count <= 0)
{
DPRINT0 ("(Connection closed by foreign host.)\n");
- tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
- exit (0);
+ finish_up();
}
old_count = buf_count;
|