Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
9bf06586
Commit
9bf06586
authored
May 26, 2013
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve logic of code vs exit_code (etc.) in cleanup.
parent
5b464543
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
cleanup.c
cleanup.c
+21
-21
No files found.
cleanup.c
View file @
9bf06586
...
...
@@ -102,15 +102,15 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
static
int
switch_step
=
0
;
static
int
exit_code
=
0
,
exit_line
=
0
;
static
const
char
*
exit_file
=
NULL
;
static
int
unmodified
_code
=
0
;
static
int
first
_code
=
0
;
SIGACTION
(
SIGUSR1
,
SIG_IGN
);
SIGACTION
(
SIGUSR2
,
SIG_IGN
);
if
(
exit_code
)
{
/* Preserve first
exit info when recursing. */
code
=
exit_
code
;
file
=
exit_
file
;
line
=
exit_
line
;
if
(
!
exit_code
)
{
/* Preserve first error
exit info when recursing. */
exit_code
=
code
;
exit_file
=
file
;
exit_line
=
line
<
0
?
-
line
:
line
;
}
/* If this is the exit at the end of the run, the server side
...
...
@@ -124,9 +124,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
#include "case_N.h"
/* case 0: */
switch_step
++
;
exit_code
=
unmodified_code
=
code
;
exit_file
=
file
;
exit_line
=
line
;
first_code
=
code
;
if
(
output_needs_newline
)
{
fputc
(
'\n'
,
stdout
);
...
...
@@ -148,8 +146,8 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
int
pid
=
wait_process
(
cleanup_child_pid
,
&
status
,
WNOHANG
);
if
(
pid
==
cleanup_child_pid
)
{
status
=
WEXITSTATUS
(
status
);
if
(
status
>
code
)
code
=
exit_code
=
status
;
if
(
status
>
exit_
code
)
exit_code
=
status
;
}
}
...
...
@@ -188,7 +186,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
if
(
code
==
RERR_SIGNAL
)
io_flush
(
FULL_FLUSH
);
}
if
(
!
code
)
if
(
!
exit_code
&&
!
code
)
io_flush
(
FULL_FLUSH
);
/* FALLTHROUGH */
...
...
@@ -197,7 +195,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
if
(
cleanup_fname
)
do_unlink
(
cleanup_fname
);
if
(
code
)
if
(
exit_
code
)
kill_all
(
SIGUSR1
);
if
(
cleanup_pid
&&
cleanup_pid
==
getpid
())
{
char
*
pidf
=
lp_pid_file
();
...
...
@@ -205,20 +203,22 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
unlink
(
lp_pid_file
());
}
if
(
code
==
0
)
{
if
(
exit_code
==
0
)
{
if
(
code
)
exit_code
=
code
;
if
(
io_error
&
IOERR_DEL_LIMIT
)
code
=
exit_code
=
RERR_DEL_LIMIT
;
exit_code
=
RERR_DEL_LIMIT
;
if
(
io_error
&
IOERR_VANISHED
)
code
=
exit_code
=
RERR_VANISHED
;
exit_code
=
RERR_VANISHED
;
if
(
io_error
&
IOERR_GENERAL
||
got_xfer_error
)
code
=
exit_code
=
RERR_PARTIAL
;
exit_code
=
RERR_PARTIAL
;
}
/* If line < 0, this exit is after a MSG_ERROR_EXIT event, so
* we don't want to output a duplicate error. */
if
((
code
&&
line
>
0
)
if
((
exit_
code
&&
line
>
0
)
||
am_daemon
||
(
logfile_name
&&
(
am_server
||
!
INFO_GTE
(
STATS
,
1
))))
log_exit
(
code
,
file
,
line
);
log_exit
(
exit_code
,
exit_file
,
exit_
line
);
/* FALLTHROUGH */
#include "case_N.h"
...
...
@@ -228,7 +228,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
rprintf
(
FINFO
,
"[%s] _exit_cleanup(code=%d, file=%s, line=%d): "
"about to call exit(%d)
\n
"
,
who_am_i
(),
unmodified_code
,
file
,
line
,
code
);
who_am_i
(),
first_code
,
exit_file
,
exit_line
,
exit_
code
);
}
/* FALLTHROUGH */
...
...
@@ -251,7 +251,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
#include "case_N.h"
switch_step
++
;
if
(
am_server
&&
code
)
if
(
am_server
&&
exit_
code
)
msleep
(
100
);
close_all
();
...
...
@@ -260,7 +260,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
break
;
}
exit
(
code
);
exit
(
exit_
code
);
}
void
cleanup_disable
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment