Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Chen Yisong
lxc
Commits
1141d9fe
Unverified
Commit
1141d9fe
authored
Oct 07, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: s/MAXPATHLEN/PATH_MAX/g
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
dc815306
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
25 deletions
+25
-25
lxc_cgroup.c
src/lxc/tools/lxc_cgroup.c
+2
-2
lxc_copy.c
src/lxc/tools/lxc_copy.c
+10
-10
lxc_destroy.c
src/lxc/tools/lxc_destroy.c
+10
-10
lxc_execute.c
src/lxc/tools/lxc_execute.c
+2
-2
lxc_unshare.c
src/lxc/tools/lxc_unshare.c
+1
-1
No files found.
src/lxc/tools/lxc_cgroup.c
View file @
1141d9fe
...
@@ -137,10 +137,10 @@ int main(int argc, char *argv[])
...
@@ -137,10 +137,10 @@ int main(int argc, char *argv[])
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
else
{
}
else
{
char
buffer
[
MAXPATHLEN
];
char
buffer
[
PATH_MAX
];
int
ret
;
int
ret
;
ret
=
c
->
get_cgroup_item
(
c
,
state_object
,
buffer
,
MAXPATHLEN
);
ret
=
c
->
get_cgroup_item
(
c
,
state_object
,
buffer
,
PATH_MAX
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to retrieve value of '%s' for '%s:%s'"
,
ERROR
(
"Failed to retrieve value of '%s' for '%s:%s'"
,
state_object
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
state_object
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
...
...
src/lxc/tools/lxc_copy.c
View file @
1141d9fe
...
@@ -263,17 +263,17 @@ static struct mnts *add_mnt(struct mnts **mnts, unsigned int *num, enum mnttype
...
@@ -263,17 +263,17 @@ static struct mnts *add_mnt(struct mnts **mnts, unsigned int *num, enum mnttype
static
int
mk_rand_ovl_dirs
(
struct
mnts
*
mnts
,
unsigned
int
num
,
struct
lxc_arguments
*
arg
)
static
int
mk_rand_ovl_dirs
(
struct
mnts
*
mnts
,
unsigned
int
num
,
struct
lxc_arguments
*
arg
)
{
{
char
upperdir
[
MAXPATHLEN
];
char
upperdir
[
PATH_MAX
];
char
workdir
[
MAXPATHLEN
];
char
workdir
[
PATH_MAX
];
unsigned
int
i
;
unsigned
int
i
;
int
ret
;
int
ret
;
struct
mnts
*
m
=
NULL
;
struct
mnts
*
m
=
NULL
;
for
(
i
=
0
,
m
=
mnts
;
i
<
num
;
i
++
,
m
++
)
{
for
(
i
=
0
,
m
=
mnts
;
i
<
num
;
i
++
,
m
++
)
{
if
(
m
->
mnt_type
==
LXC_MNT_OVL
)
{
if
(
m
->
mnt_type
==
LXC_MNT_OVL
)
{
ret
=
snprintf
(
upperdir
,
MAXPATHLEN
,
"%s/%s/delta#XXXXXX"
,
ret
=
snprintf
(
upperdir
,
PATH_MAX
,
"%s/%s/delta#XXXXXX"
,
arg
->
newpath
,
arg
->
newname
);
arg
->
newpath
,
arg
->
newname
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
-
1
;
return
-
1
;
if
(
!
mkdtemp
(
upperdir
))
if
(
!
mkdtemp
(
upperdir
))
...
@@ -285,9 +285,9 @@ static int mk_rand_ovl_dirs(struct mnts *mnts, unsigned int num, struct lxc_argu
...
@@ -285,9 +285,9 @@ static int mk_rand_ovl_dirs(struct mnts *mnts, unsigned int num, struct lxc_argu
}
}
if
(
m
->
mnt_type
==
LXC_MNT_OVL
)
{
if
(
m
->
mnt_type
==
LXC_MNT_OVL
)
{
ret
=
snprintf
(
workdir
,
MAXPATHLEN
,
"%s/%s/work#XXXXXX"
,
ret
=
snprintf
(
workdir
,
PATH_MAX
,
"%s/%s/work#XXXXXX"
,
arg
->
newpath
,
arg
->
newname
);
arg
->
newpath
,
arg
->
newname
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
-
1
;
return
-
1
;
if
(
!
mkdtemp
(
workdir
))
if
(
!
mkdtemp
(
workdir
))
...
@@ -381,7 +381,7 @@ static int do_clone_ephemeral(struct lxc_container *c,
...
@@ -381,7 +381,7 @@ static int do_clone_ephemeral(struct lxc_container *c,
struct
lxc_arguments
*
arg
,
char
**
args
,
int
flags
)
struct
lxc_arguments
*
arg
,
char
**
args
,
int
flags
)
{
{
char
*
premount
;
char
*
premount
;
char
randname
[
MAXPATHLEN
];
char
randname
[
PATH_MAX
];
unsigned
int
i
;
unsigned
int
i
;
int
ret
=
0
;
int
ret
=
0
;
bool
bret
=
true
,
started
=
false
;
bool
bret
=
true
,
started
=
false
;
...
@@ -391,8 +391,8 @@ static int do_clone_ephemeral(struct lxc_container *c,
...
@@ -391,8 +391,8 @@ static int do_clone_ephemeral(struct lxc_container *c,
attach_options
.
env_policy
=
LXC_ATTACH_CLEAR_ENV
;
attach_options
.
env_policy
=
LXC_ATTACH_CLEAR_ENV
;
if
(
!
arg
->
newname
)
{
if
(
!
arg
->
newname
)
{
ret
=
snprintf
(
randname
,
MAXPATHLEN
,
"%s/%s_XXXXXX"
,
arg
->
newpath
,
arg
->
name
);
ret
=
snprintf
(
randname
,
PATH_MAX
,
"%s/%s_XXXXXX"
,
arg
->
newpath
,
arg
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
-
1
;
return
-
1
;
if
(
!
mkdtemp
(
randname
))
if
(
!
mkdtemp
(
randname
))
...
@@ -481,7 +481,7 @@ destroy_and_put:
...
@@ -481,7 +481,7 @@ destroy_and_put:
if
(
started
)
if
(
started
)
clone
->
shutdown
(
clone
,
-
1
);
clone
->
shutdown
(
clone
,
-
1
);
ret
=
clone
->
get_config_item
(
clone
,
"lxc.ephemeral"
,
tmp_buf
,
MAXPATHLEN
);
ret
=
clone
->
get_config_item
(
clone
,
"lxc.ephemeral"
,
tmp_buf
,
PATH_MAX
);
if
(
ret
>
0
&&
strcmp
(
tmp_buf
,
"0"
))
if
(
ret
>
0
&&
strcmp
(
tmp_buf
,
"0"
))
clone
->
destroy
(
clone
);
clone
->
destroy
(
clone
);
...
...
src/lxc/tools/lxc_destroy.c
View file @
1141d9fe
...
@@ -84,11 +84,11 @@ static bool do_destroy(struct lxc_container *c)
...
@@ -84,11 +84,11 @@ static bool do_destroy(struct lxc_container *c)
{
{
int
ret
;
int
ret
;
bool
bret
=
true
;
bool
bret
=
true
;
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
/* First check whether the container has dependent clones or snapshots. */
/* First check whether the container has dependent clones or snapshots. */
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/lxc_snapshots"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/lxc_snapshots"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
if
(
file_exists
(
path
))
{
if
(
file_exists
(
path
))
{
...
@@ -96,8 +96,8 @@ static bool do_destroy(struct lxc_container *c)
...
@@ -96,8 +96,8 @@ static bool do_destroy(struct lxc_container *c)
return
false
;
return
false
;
}
}
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/snaps"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/snaps"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
if
(
rmdir
(
path
)
<
0
&&
errno
!=
ENOENT
)
{
if
(
rmdir
(
path
)
<
0
&&
errno
!=
ENOENT
)
{
...
@@ -138,7 +138,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
...
@@ -138,7 +138,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
struct
lxc_container
*
c1
;
struct
lxc_container
*
c1
;
struct
stat
fbuf
;
struct
stat
fbuf
;
bool
bret
=
false
;
bool
bret
=
false
;
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
char
*
lxcpath
=
NULL
;
char
*
lxcpath
=
NULL
;
char
*
lxcname
=
NULL
;
char
*
lxcname
=
NULL
;
...
@@ -147,8 +147,8 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
...
@@ -147,8 +147,8 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
ssize_t
bytes
;
ssize_t
bytes
;
/* Destroy clones. */
/* Destroy clones. */
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/lxc_snapshots"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/lxc_snapshots"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
fd
=
open
(
path
,
O_RDONLY
|
O_CLOEXEC
);
fd
=
open
(
path
,
O_RDONLY
|
O_CLOEXEC
);
...
@@ -195,8 +195,8 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
...
@@ -195,8 +195,8 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
}
}
/* Destroy snapshots located in the containers snap/ folder. */
/* Destroy snapshots located in the containers snap/ folder. */
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/snaps"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/snaps"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
if
(
rmdir
(
path
)
<
0
&&
errno
!=
ENOENT
)
if
(
rmdir
(
path
)
<
0
&&
errno
!=
ENOENT
)
...
...
src/lxc/tools/lxc_execute.c
View file @
1141d9fe
...
@@ -129,11 +129,11 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
...
@@ -129,11 +129,11 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
static
bool
set_argv
(
struct
lxc_container
*
c
,
struct
lxc_arguments
*
args
)
static
bool
set_argv
(
struct
lxc_container
*
c
,
struct
lxc_arguments
*
args
)
{
{
int
ret
;
int
ret
;
char
buf
[
MAXPATHLEN
];
char
buf
[
PATH_MAX
];
char
**
components
,
**
p
;
char
**
components
,
**
p
;
buf
[
0
]
=
'\0'
;
buf
[
0
]
=
'\0'
;
ret
=
c
->
get_config_item
(
c
,
"lxc.execute.cmd"
,
buf
,
MAXPATHLEN
);
ret
=
c
->
get_config_item
(
c
,
"lxc.execute.cmd"
,
buf
,
PATH_MAX
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
false
;
return
false
;
...
...
src/lxc/tools/lxc_unshare.c
View file @
1141d9fe
...
@@ -182,7 +182,7 @@ static int get_namespace_flags(char *namespaces)
...
@@ -182,7 +182,7 @@ static int get_namespace_flags(char *namespaces)
static
bool
lookup_user
(
const
char
*
optarg
,
uid_t
*
uid
)
static
bool
lookup_user
(
const
char
*
optarg
,
uid_t
*
uid
)
{
{
char
name
[
MAXPATHLEN
];
char
name
[
PATH_MAX
];
struct
passwd
pwent
;
struct
passwd
pwent
;
struct
passwd
*
pwentp
=
NULL
;
struct
passwd
*
pwentp
=
NULL
;
char
*
buf
;
char
*
buf
;
...
...
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