Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
6661b555
Commit
6661b555
authored
Nov 30, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dump: Don't forget to close opened file on error path
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@openvz.org
>
parent
555efbb3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
cr-dump.c
cr-dump.c
+10
-5
No files found.
cr-dump.c
View file @
6661b555
...
...
@@ -226,7 +226,8 @@ static int dump_one_fd(char *pid_fd_dir, int dir, char *fd_name, unsigned long p
{
struct
statfs
stfs_buf
;
struct
stat
st_buf
;
int
fd
;
int
err
=
-
1
;
int
fd
=
-
1
;
fd
=
openat
(
dir
,
fd_name
,
O_RDONLY
);
if
(
fd
<
0
)
{
...
...
@@ -236,16 +237,17 @@ static int dump_one_fd(char *pid_fd_dir, int dir, char *fd_name, unsigned long p
if
(
fstat
(
fd
,
&
st_buf
)
<
0
)
{
pr_perror
(
"Can't get stat on %s
\n
"
,
fd_name
);
return
-
1
;
goto
out_close
;
}
if
(
S_ISCHR
(
st_buf
.
st_mode
)
&&
(
major
(
st_buf
.
st_rdev
)
==
TTY_MAJOR
||
(
major
(
st_buf
.
st_rdev
)
==
TTY_MAJOR
||
major
(
st_buf
.
st_rdev
)
==
UNIX98_PTY_SLAVE_MAJOR
))
{
/* skip only standard destriptors */
if
(
atoi
(
fd_name
)
<
3
)
{
err
=
0
;
pr_info
(
"... Skipping tty ... %s/%s
\n
"
,
pid_fd_dir
,
fd_name
);
return
0
;
goto
out_close
;
}
goto
err
;
}
...
...
@@ -269,7 +271,10 @@ static int dump_one_fd(char *pid_fd_dir, int dir, char *fd_name, unsigned long p
err:
pr_err
(
"Can't dump file %s of that type [%x]
\n
"
,
fd_name
,
st_buf
.
st_mode
);
return
1
;
out_close:
close_safe
(
&
fd
);
return
err
;
}
static
int
read_fd_params
(
pid_t
pid
,
char
*
fd
,
unsigned
long
*
pos
,
unsigned
int
*
flags
)
...
...
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