Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2754edba
Commit
2754edba
authored
Oct 31, 2006
by
msvensson@shellback.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the reading of .pid files from var/run
- Only read *.pid - Only allow it to contain a number
parent
64eb6553
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
22 deletions
+30
-22
mysql-test/lib/mtr_io.pl
mysql-test/lib/mtr_io.pl
+5
-7
mysql-test/lib/mtr_process.pl
mysql-test/lib/mtr_process.pl
+25
-15
No files found.
mysql-test/lib/mtr_io.pl
View file @
2754edba
...
...
@@ -37,18 +37,16 @@ sub mtr_get_pid_from_file ($) {
open
(
FILE
,
'
<
',
$pid_file_path
)
or
mtr_error
("
can't open file
\"
$pid_file_path
\"
: $!
");
# Read pid number from file
my
$pid
=
<
FILE
>
;
chomp
(
$pid
)
if
defined
$pid
;
close
FILE
;
return
$pid
if
defined
$pid
&&
$pid
ne
''
;
return
$pid
if
$pid
=~
/^(\d+)/
;
mtr_debug
("
Pid file '
$pid_file_path
'
is empty.
"
.
"
Sleeping
$timeout
second(s)...
");
mtr_debug
("
Pid file '
$pid_file_path
'
does not yet contain pid number.
\n
"
.
"
Sleeping
$timeout
second(s)
more
...
");
sleep
(
1
);
sleep
(
$timeout
);
}
mtr_error
("
Pid file '
$pid_file_path
' is corrupted.
"
.
...
...
mysql-test/lib/mtr_process.pl
View file @
2754edba
...
...
@@ -438,25 +438,35 @@ sub mtr_kill_leftovers () {
while
(
my
$elem
=
readdir
(
RUNDIR
)
)
{
my
$pidfile
=
"
$rundir
/
$elem
";
if
(
-
f
$pidfile
)
# Only read pid from files that end with .pid
if
(
$elem
=~
/.*[.]pid$/
)
{
mtr_debug
("
Processing PID file: '
$pidfile
'...
");
my
$pid
=
mtr_get_pid_from_file
(
$pidfile
)
;
my
$pidfile
=
"
$rundir
/
$elem
"
;
mtr_debug
("
Got pid:
$pid
from file '
$pidfile
'
");
if
(
-
f
$pidfile
)
{
mtr_debug
("
Processing PID file: '
$pidfile
'...
");
if
(
$::glob_cygwin_perl
or
kill
(
0
,
$pid
)
)
{
mtr_debug
("
There is process with pid
$pid
-- scheduling for kill.
");
push
(
@pids
,
$pid
);
# We know (cygwin guess) it exists
}
else
{
mtr_debug
("
There is no process with pid
$pid
-- skipping.
");
}
my
$pid
=
mtr_get_pid_from_file
(
$pidfile
);
mtr_debug
("
Got pid:
$pid
from file '
$pidfile
'
");
if
(
$::glob_cygwin_perl
or
kill
(
0
,
$pid
)
)
{
mtr_debug
("
There is process with pid
$pid
-- scheduling for kill.
");
push
(
@pids
,
$pid
);
# We know (cygwin guess) it exists
}
else
{
mtr_debug
("
There is no process with pid
$pid
-- skipping.
");
}
}
}
else
{
mtr_warning
("
Found non pid file
$elem
in
$rundir
");
next
;
}
}
closedir
(
RUNDIR
);
...
...
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