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
18d91708
Commit
18d91708
authored
Nov 12, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: Add flags to cr_system
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
e5a91658
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
+10
-10
util.h
include/util.h
+2
-2
mount.c
mount.c
+2
-2
net.c
net.c
+2
-2
netfilter.c
netfilter.c
+1
-1
util.c
util.c
+3
-3
No files found.
include/util.h
View file @
18d91708
...
...
@@ -172,9 +172,9 @@ extern int is_anon_link_type(char *link, char *type);
extern
void
*
shmalloc
(
size_t
bytes
);
extern
void
shfree_last
(
void
*
ptr
);
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
[]
,
unsigned
flags
);
extern
int
cr_system_userns
(
int
in
,
int
out
,
int
err
,
char
*
cmd
,
char
*
const
argv
[],
int
userns_pid
);
char
*
const
argv
[],
unsigned
flags
,
int
userns_pid
);
extern
int
cr_daemon
(
int
nochdir
,
int
noclose
,
int
*
keep_fd
,
int
close_fd
);
extern
int
is_root_user
(
void
);
...
...
mount.c
View file @
18d91708
...
...
@@ -1203,7 +1203,7 @@ static int tmpfs_dump(struct mount_info *pm)
"--preserve-permissions"
,
"--sparse"
,
"--numeric-owner"
,
"--directory"
,
tmpfs_path
,
"."
,
NULL
},
userns_pid
);
"--directory"
,
tmpfs_path
,
"."
,
NULL
},
0
,
userns_pid
);
if
(
ret
)
pr_err
(
"Can't dump tmpfs content
\n
"
);
...
...
@@ -1256,7 +1256,7 @@ static int tmpfs_restore(struct mount_info *pm)
ret
=
cr_system
(
img_raw_fd
(
img
),
-
1
,
-
1
,
"tar"
,
(
char
*
[])
{
"tar"
,
"--extract"
,
"--gzip"
,
"--no-unquote"
,
"--no-wildcards"
,
"--directory"
,
pm
->
mountpoint
,
NULL
});
"--directory"
,
pm
->
mountpoint
,
NULL
}
,
0
);
close_image
(
img
);
if
(
ret
)
{
...
...
net.c
View file @
18d91708
...
...
@@ -600,7 +600,7 @@ static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout)
ip_tool_cmd
=
"ip"
;
ret
=
cr_system
(
fdin
,
fdout
,
-
1
,
ip_tool_cmd
,
(
char
*
[])
{
"ip"
,
arg1
,
arg2
,
arg3
,
NULL
});
(
char
*
[])
{
"ip"
,
arg1
,
arg2
,
arg3
,
NULL
}
,
0
);
if
(
ret
)
{
pr_err
(
"IP tool failed on %s %s
\n
"
,
arg1
,
arg2
);
return
-
1
;
...
...
@@ -618,7 +618,7 @@ static int run_iptables_tool(char *def_cmd, int fdin, int fdout)
if
(
!
cmd
)
cmd
=
def_cmd
;
pr_debug
(
"
\t
Running %s for %s
\n
"
,
cmd
,
def_cmd
);
ret
=
cr_system
(
fdin
,
fdout
,
-
1
,
"sh"
,
(
char
*
[])
{
"sh"
,
"-c"
,
cmd
,
NULL
});
ret
=
cr_system
(
fdin
,
fdout
,
-
1
,
"sh"
,
(
char
*
[])
{
"sh"
,
"-c"
,
cmd
,
NULL
}
,
0
);
if
(
ret
)
pr_err
(
"%s failed
\n
"
,
def_cmd
);
...
...
netfilter.c
View file @
18d91708
...
...
@@ -64,7 +64,7 @@ static int nf_connection_switch_raw(int family, u32 *src_addr, u16 src_port,
* cr_system is used here, because it blocks SIGCHLD before waiting
* a child and the child can't be waited from SIGCHLD handler.
*/
ret
=
cr_system
(
-
1
,
-
1
,
-
1
,
"sh"
,
argv
);
ret
=
cr_system
(
-
1
,
-
1
,
-
1
,
"sh"
,
argv
,
0
);
if
(
ret
<
0
||
!
WIFEXITED
(
ret
)
||
WEXITSTATUS
(
ret
))
{
pr_perror
(
"Iptables configuration failed"
);
return
-
1
;
...
...
util.c
View file @
18d91708
...
...
@@ -509,13 +509,13 @@ void shfree_last(void *ptr)
* If "in" is negative, stdin will be closed.
* If "out" or "err" are negative, a log file descriptor will be used.
*/
int
cr_system
(
int
in
,
int
out
,
int
err
,
char
*
cmd
,
char
*
const
argv
[])
int
cr_system
(
int
in
,
int
out
,
int
err
,
char
*
cmd
,
char
*
const
argv
[]
,
unsigned
flags
)
{
return
cr_system_userns
(
in
,
out
,
err
,
cmd
,
argv
,
-
1
);
return
cr_system_userns
(
in
,
out
,
err
,
cmd
,
argv
,
flags
,
-
1
);
}
int
cr_system_userns
(
int
in
,
int
out
,
int
err
,
char
*
cmd
,
char
*
const
argv
[],
int
userns_pid
)
char
*
const
argv
[],
unsigned
flags
,
int
userns_pid
)
{
sigset_t
blockmask
,
oldmask
;
int
ret
=
-
1
,
status
;
...
...
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