Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
636d2fe0
Commit
636d2fe0
authored
15 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
signal handling to cleanup on SIGINT and SIGTERM
parent
fb2425b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/ftpserver.pl
+8
-6
8 additions, 6 deletions
tests/ftpserver.pl
with
8 additions
and
6 deletions
tests/ftpserver.pl
+
8
−
6
View file @
636d2fe0
...
...
@@ -122,16 +122,16 @@ do {
sub
catch_zap
{
my
$signame
=
shift
;
print
STDERR
"
ftpserver.pl received SIG
$signame
, exiting
\n
";
ftpkillslaves
(
1
);
unlink
(
$pidfile
);
if
(
$serverlogslocked
)
{
$serverlogslocked
=
0
;
clear_advisor_read_lock
(
$SERVERLOGS_LOCK
);
}
die
"
Somebody sent me a SIG
$signame
"
;
exit
;
}
$SIG
{
INT
}
=
\
&catch_zap
;
$SIG
{
KILL
}
=
\
&catch_zap
;
$SIG
{
TERM
}
=
\
&catch_zap
;
my
$sfpid
;
...
...
@@ -153,6 +153,7 @@ sub sysread_or_die {
logmsg
"
Error: ftp
$ftpdnum$ext
sysread error: $!
\n
";
kill
(
9
,
$sfpid
);
waitpid
(
$sfpid
,
0
);
unlink
(
$pidfile
);
if
(
$serverlogslocked
)
{
$serverlogslocked
=
0
;
clear_advisor_read_lock
(
$SERVERLOGS_LOCK
);
...
...
@@ -166,6 +167,7 @@ sub sysread_or_die {
logmsg
"
Error: ftp
$ftpdnum$ext
read zero
\n
";
kill
(
9
,
$sfpid
);
waitpid
(
$sfpid
,
0
);
unlink
(
$pidfile
);
if
(
$serverlogslocked
)
{
$serverlogslocked
=
0
;
clear_advisor_read_lock
(
$SERVERLOGS_LOCK
);
...
...
@@ -191,6 +193,7 @@ sub startsf {
logmsg
"
Failed sockfilt command:
$cmd
\n
";
kill
(
9
,
$sfpid
);
waitpid
(
$sfpid
,
0
);
unlink
(
$pidfile
);
if
(
$serverlogslocked
)
{
$serverlogslocked
=
0
;
clear_advisor_read_lock
(
$SERVERLOGS_LOCK
);
...
...
@@ -199,9 +202,6 @@ sub startsf {
}
}
# remove the file here so that if startsf() fails, it is very noticeable
unlink
(
$pidfile
);
startsf
();
logmsg
sprintf
("
FTP server listens on port IPv%d/
$port
\n
",
$ipv6
?
6
:
4
);
...
...
@@ -939,6 +939,8 @@ while(1) {
print
SFWRITE
"
QUIT
\n
";
waitpid
$sfpid
,
0
;
unlink
(
$pidfile
);
if
(
$serverlogslocked
)
{
$serverlogslocked
=
0
;
clear_advisor_read_lock
(
$SERVERLOGS_LOCK
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment