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
1a7c7d04
Commit
1a7c7d04
authored
Nov 29, 2012
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fd: Consolidate . and .. checks in various readdir callers
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
86886b63
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
13 deletions
+10
-13
cr-dump.c
cr-dump.c
+2
-6
files.c
files.c
+1
-3
util.h
include/util.h
+6
-1
mount.c
mount.c
+1
-3
No files found.
cr-dump.c
View file @
1a7c7d04
...
@@ -168,9 +168,7 @@ static int collect_fds(pid_t pid, struct parasite_drain_fd *dfds)
...
@@ -168,9 +168,7 @@ static int collect_fds(pid_t pid, struct parasite_drain_fd *dfds)
n
=
0
;
n
=
0
;
while
((
de
=
readdir
(
fd_dir
)))
{
while
((
de
=
readdir
(
fd_dir
)))
{
if
(
!
strcmp
(
de
->
d_name
,
"."
))
if
(
dir_dots
(
de
))
continue
;
if
(
!
strcmp
(
de
->
d_name
,
".."
))
continue
;
continue
;
if
(
n
>
PARASITE_MAX_FDS
-
1
)
if
(
n
>
PARASITE_MAX_FDS
-
1
)
...
@@ -1029,9 +1027,7 @@ static int parse_children(pid_t pid, pid_t **_c, int *_n)
...
@@ -1029,9 +1027,7 @@ static int parse_children(pid_t pid, pid_t **_c, int *_n)
return
-
1
;
return
-
1
;
while
((
de
=
readdir
(
dir
)))
{
while
((
de
=
readdir
(
dir
)))
{
if
(
!
strcmp
(
de
->
d_name
,
"."
))
if
(
dir_dots
(
de
))
continue
;
if
(
!
strcmp
(
de
->
d_name
,
".."
))
continue
;
continue
;
file
=
fopen_proc
(
pid
,
"task/%s/children"
,
de
->
d_name
);
file
=
fopen_proc
(
pid
,
"task/%s/children"
,
de
->
d_name
);
...
...
files.c
View file @
1a7c7d04
...
@@ -507,9 +507,7 @@ static int close_old_fds(struct pstree_item *me)
...
@@ -507,9 +507,7 @@ static int close_old_fds(struct pstree_item *me)
return
-
1
;
return
-
1
;
while
((
de
=
readdir
(
dir
)))
{
while
((
de
=
readdir
(
dir
)))
{
if
(
!
strcmp
(
de
->
d_name
,
"."
))
if
(
dir_dots
(
de
))
continue
;
if
(
!
strcmp
(
de
->
d_name
,
".."
))
continue
;
continue
;
ret
=
sscanf
(
de
->
d_name
,
"%d"
,
&
fd
);
ret
=
sscanf
(
de
->
d_name
,
"%d"
,
&
fd
);
...
...
include/util.h
View file @
1a7c7d04
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include <signal.h>
#include <signal.h>
#include <stdio.h>
#include <stdio.h>
#include <errno.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/statfs.h>
#include <sys/statfs.h>
#include <dirent.h>
#include <dirent.h>
...
@@ -325,4 +325,9 @@ extern int run_scripts(char *action);
...
@@ -325,4 +325,9 @@ extern int run_scripts(char *action);
extern
int
cr_system
(
int
in
,
int
out
,
int
err
,
char
*
cmd
,
char
*
const
argv
[]);
extern
int
cr_system
(
int
in
,
int
out
,
int
err
,
char
*
cmd
,
char
*
const
argv
[]);
static
inline
bool
dir_dots
(
struct
dirent
*
de
)
{
return
!
strcmp
(
de
->
d_name
,
"."
)
||
!
strcmp
(
de
->
d_name
,
".."
);
}
#endif
/* UTIL_H_ */
#endif
/* UTIL_H_ */
mount.c
View file @
1a7c7d04
...
@@ -308,9 +308,7 @@ static int binfmt_misc_dump(struct mount_info *pm)
...
@@ -308,9 +308,7 @@ static int binfmt_misc_dump(struct mount_info *pm)
return
-
1
;
return
-
1
;
while
((
de
=
readdir
(
fdir
)))
{
while
((
de
=
readdir
(
fdir
)))
{
if
(
!
strcmp
(
de
->
d_name
,
"."
))
if
(
dir_dots
(
de
))
continue
;
if
(
!
strcmp
(
de
->
d_name
,
".."
))
continue
;
continue
;
if
(
!
strcmp
(
de
->
d_name
,
"register"
))
if
(
!
strcmp
(
de
->
d_name
,
"register"
))
continue
;
continue
;
...
...
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