summaryrefslogtreecommitdiff
path: root/src/httrack.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2012-05-01 16:25:50 +0000
committerXavier Roche <xroche@users.noreply.github.com>2012-05-01 16:25:50 +0000
commit4c7ec9bf95f823654bae8dac7edbed2615adb27e (patch)
treee45059be12207f4a2f6584776362747df1b3ef1b /src/httrack.c
parent8cd02da424dc7238c1ee39339699cc8a7f98ef22 (diff)
Do not interpret ^C before mirror is finished, or after!
Diffstat (limited to 'src/httrack.c')
-rw-r--r--src/httrack.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/httrack.c b/src/httrack.c
index 3c99dc7..1d25d69 100644
--- a/src/httrack.c
+++ b/src/httrack.c
@@ -752,11 +752,9 @@ static void sig_doback(int blind) { // mettre en backing
out = open("hts-nohup.out",O_CREAT|O_WRONLY,S_IRUSR|S_IWUSR);
if (out == -1)
out = open("/dev/null",O_WRONLY,S_IRUSR|S_IWUSR);
- close(0);
- close(1);
- dup(out);
- close(2);
- dup(out);
+ dup2(out, 0);
+ dup2(out, 1);
+ dup2(out, 2);
//
switch (fork()) {
case 0:
@@ -765,7 +763,6 @@ static void sig_doback(int blind) { // mettre en backing
fprintf(stderr,"Error: can not fork process\n");
break;
default: // pere
- usleep(100000); // pause 1/10s "A microsecond is .000001s"
_exit(0);
break;
}
@@ -773,11 +770,15 @@ static void sig_doback(int blind) { // mettre en backing
#endif
static void sig_leave( int code ) {
- signal(code, sig_term); // quitter si encore
- printf("\n** Finishing pending transfers.. press again ^C to quit.\n");
- if (global_opt != NULL) {
- // ask for stop
- global_opt->state.stop=1;
+ if (global_opt != NULL && global_opt->state._hts_in_mirror) {
+ signal(code, sig_term); // quitter si encore
+ printf("\n** Finishing pending transfers.. press again ^C to quit.\n");
+ if (global_opt != NULL) {
+ // ask for stop
+ global_opt->state.stop=1;
+ }
+ } else {
+ sig_term(code);
}
}