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
8a22c168
Unverified
Commit
8a22c168
authored
Oct 07, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxccontainer: s/MAXPATHLEN/PATH_MAX/g
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
85d67fba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
55 deletions
+55
-55
lxccontainer.c
src/lxc/lxccontainer.c
+55
-55
No files found.
src/lxc/lxccontainer.c
View file @
8a22c168
...
@@ -2673,8 +2673,8 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
...
@@ -2673,8 +2673,8 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
struct
stat
fbuf
;
struct
stat
fbuf
;
void
*
buf
=
NULL
;
void
*
buf
=
NULL
;
char
*
del
=
NULL
;
char
*
del
=
NULL
;
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
char
newpath
[
MAXPATHLEN
];
char
newpath
[
PATH_MAX
];
int
fd
,
ret
,
n
=
0
,
v
=
0
;
int
fd
,
ret
,
n
=
0
,
v
=
0
;
bool
bret
=
false
;
bool
bret
=
false
;
size_t
len
=
0
,
bytes
=
0
;
size_t
len
=
0
,
bytes
=
0
;
...
@@ -2682,12 +2682,12 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
...
@@ -2682,12 +2682,12 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
if
(
container_disk_lock
(
c0
))
if
(
container_disk_lock
(
c0
))
return
false
;
return
false
;
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/lxc_snapshots"
,
c0
->
config_path
,
c0
->
name
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/lxc_snapshots"
,
c0
->
config_path
,
c0
->
name
);
if
(
ret
<
0
||
ret
>
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>
PATH_MAX
)
goto
out
;
goto
out
;
ret
=
snprintf
(
newpath
,
MAXPATHLEN
,
"%s
\n
%s
\n
"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
newpath
,
PATH_MAX
,
"%s
\n
%s
\n
"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>
PATH_MAX
)
goto
out
;
goto
out
;
/* If we find an lxc-snapshot file using the old format only listing the
/* If we find an lxc-snapshot file using the old format only listing the
...
@@ -2798,14 +2798,14 @@ out:
...
@@ -2798,14 +2798,14 @@ out:
void
mod_all_rdeps
(
struct
lxc_container
*
c
,
bool
inc
)
void
mod_all_rdeps
(
struct
lxc_container
*
c
,
bool
inc
)
{
{
struct
lxc_container
*
p
;
struct
lxc_container
*
p
;
char
*
lxcpath
=
NULL
,
*
lxcname
=
NULL
,
path
[
MAXPATHLEN
];
char
*
lxcpath
=
NULL
,
*
lxcname
=
NULL
,
path
[
PATH_MAX
];
size_t
pathlen
=
0
,
namelen
=
0
;
size_t
pathlen
=
0
,
namelen
=
0
;
FILE
*
f
;
FILE
*
f
;
int
ret
;
int
ret
;
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/lxc_rdepends"
,
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/lxc_rdepends"
,
c
->
config_path
,
c
->
name
);
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"Path name too long"
);
ERROR
(
"Path name too long"
);
return
;
return
;
}
}
...
@@ -2845,14 +2845,14 @@ out:
...
@@ -2845,14 +2845,14 @@ out:
static
bool
has_fs_snapshots
(
struct
lxc_container
*
c
)
static
bool
has_fs_snapshots
(
struct
lxc_container
*
c
)
{
{
FILE
*
f
;
FILE
*
f
;
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
int
ret
,
v
;
int
ret
,
v
;
struct
stat
fbuf
;
struct
stat
fbuf
;
bool
bret
=
false
;
bool
bret
=
false
;
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/lxc_snapshots"
,
c
->
config_path
,
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/lxc_snapshots"
,
c
->
config_path
,
c
->
name
);
c
->
name
);
if
(
ret
<
0
||
ret
>
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>
PATH_MAX
)
goto
out
;
goto
out
;
/* If the file doesn't exist there are no snapshots. */
/* If the file doesn't exist there are no snapshots. */
...
@@ -2880,7 +2880,7 @@ out:
...
@@ -2880,7 +2880,7 @@ out:
static
bool
has_snapshots
(
struct
lxc_container
*
c
)
static
bool
has_snapshots
(
struct
lxc_container
*
c
)
{
{
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
struct
dirent
*
direntp
;
struct
dirent
*
direntp
;
int
count
=
0
;
int
count
=
0
;
DIR
*
dir
;
DIR
*
dir
;
...
@@ -3408,7 +3408,7 @@ static int copyhooks(struct lxc_container *oldc, struct lxc_container *c)
...
@@ -3408,7 +3408,7 @@ static int copyhooks(struct lxc_container *oldc, struct lxc_container *c)
lxc_list_for_each
(
it
,
&
c
->
lxc_conf
->
hooks
[
i
])
{
lxc_list_for_each
(
it
,
&
c
->
lxc_conf
->
hooks
[
i
])
{
char
*
hookname
=
it
->
elem
;
char
*
hookname
=
it
->
elem
;
char
*
fname
=
strrchr
(
hookname
,
'/'
);
char
*
fname
=
strrchr
(
hookname
,
'/'
);
char
tmppath
[
MAXPATHLEN
];
char
tmppath
[
PATH_MAX
];
if
(
!
fname
)
/* relative path - we don't support, but maybe we should */
if
(
!
fname
)
/* relative path - we don't support, but maybe we should */
return
0
;
return
0
;
...
@@ -3418,9 +3418,9 @@ static int copyhooks(struct lxc_container *oldc, struct lxc_container *c)
...
@@ -3418,9 +3418,9 @@ static int copyhooks(struct lxc_container *oldc, struct lxc_container *c)
}
}
/* copy the script, and change the entry in confile */
/* copy the script, and change the entry in confile */
ret
=
snprintf
(
tmppath
,
MAXPATHLEN
,
"%s/%s/%s"
,
ret
=
snprintf
(
tmppath
,
PATH_MAX
,
"%s/%s/%s"
,
c
->
config_path
,
c
->
name
,
fname
+
1
);
c
->
config_path
,
c
->
name
,
fname
+
1
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
-
1
;
return
-
1
;
ret
=
copy_file
(
it
->
elem
,
tmppath
);
ret
=
copy_file
(
it
->
elem
,
tmppath
);
...
@@ -3450,7 +3450,7 @@ static int copyhooks(struct lxc_container *oldc, struct lxc_container *c)
...
@@ -3450,7 +3450,7 @@ static int copyhooks(struct lxc_container *oldc, struct lxc_container *c)
static
int
copy_fstab
(
struct
lxc_container
*
oldc
,
struct
lxc_container
*
c
)
static
int
copy_fstab
(
struct
lxc_container
*
oldc
,
struct
lxc_container
*
c
)
{
{
char
newpath
[
MAXPATHLEN
];
char
newpath
[
PATH_MAX
];
char
*
oldpath
=
oldc
->
lxc_conf
->
fstab
;
char
*
oldpath
=
oldc
->
lxc_conf
->
fstab
;
int
ret
;
int
ret
;
...
@@ -3463,9 +3463,9 @@ static int copy_fstab(struct lxc_container *oldc, struct lxc_container *c)
...
@@ -3463,9 +3463,9 @@ static int copy_fstab(struct lxc_container *oldc, struct lxc_container *c)
if
(
!
p
)
if
(
!
p
)
return
-
1
;
return
-
1
;
ret
=
snprintf
(
newpath
,
MAXPATHLEN
,
"%s/%s%s"
,
ret
=
snprintf
(
newpath
,
PATH_MAX
,
"%s/%s%s"
,
c
->
config_path
,
c
->
name
,
p
);
c
->
config_path
,
c
->
name
,
p
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"error printing new path for %s"
,
oldpath
);
ERROR
(
"error printing new path for %s"
,
oldpath
);
return
-
1
;
return
-
1
;
}
}
...
@@ -3498,19 +3498,19 @@ static int copy_fstab(struct lxc_container *oldc, struct lxc_container *c)
...
@@ -3498,19 +3498,19 @@ static int copy_fstab(struct lxc_container *oldc, struct lxc_container *c)
static
void
copy_rdepends
(
struct
lxc_container
*
c
,
struct
lxc_container
*
c0
)
static
void
copy_rdepends
(
struct
lxc_container
*
c
,
struct
lxc_container
*
c0
)
{
{
char
path0
[
MAXPATHLEN
],
path1
[
MAXPATHLEN
];
char
path0
[
PATH_MAX
],
path1
[
PATH_MAX
];
int
ret
;
int
ret
;
ret
=
snprintf
(
path0
,
MAXPATHLEN
,
"%s/%s/lxc_rdepends"
,
c0
->
config_path
,
ret
=
snprintf
(
path0
,
PATH_MAX
,
"%s/%s/lxc_rdepends"
,
c0
->
config_path
,
c0
->
name
);
c0
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
WARN
(
"Error copying reverse dependencies"
);
WARN
(
"Error copying reverse dependencies"
);
return
;
return
;
}
}
ret
=
snprintf
(
path1
,
MAXPATHLEN
,
"%s/%s/lxc_rdepends"
,
c
->
config_path
,
ret
=
snprintf
(
path1
,
PATH_MAX
,
"%s/%s/lxc_rdepends"
,
c
->
config_path
,
c
->
name
);
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
WARN
(
"Error copying reverse dependencies"
);
WARN
(
"Error copying reverse dependencies"
);
return
;
return
;
}
}
...
@@ -3524,13 +3524,13 @@ static void copy_rdepends(struct lxc_container *c, struct lxc_container *c0)
...
@@ -3524,13 +3524,13 @@ static void copy_rdepends(struct lxc_container *c, struct lxc_container *c0)
static
bool
add_rdepends
(
struct
lxc_container
*
c
,
struct
lxc_container
*
c0
)
static
bool
add_rdepends
(
struct
lxc_container
*
c
,
struct
lxc_container
*
c0
)
{
{
int
ret
;
int
ret
;
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
FILE
*
f
;
FILE
*
f
;
bool
bret
;
bool
bret
;
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/lxc_rdepends"
,
c
->
config_path
,
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/lxc_rdepends"
,
c
->
config_path
,
c
->
name
);
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
f
=
fopen
(
path
,
"a"
);
f
=
fopen
(
path
,
"a"
);
...
@@ -3644,7 +3644,7 @@ static int clone_update_rootfs(struct clone_update_data *data)
...
@@ -3644,7 +3644,7 @@ static int clone_update_rootfs(struct clone_update_data *data)
int
flags
=
data
->
flags
;
int
flags
=
data
->
flags
;
char
**
hookargs
=
data
->
hookargs
;
char
**
hookargs
=
data
->
hookargs
;
int
ret
=
-
1
;
int
ret
=
-
1
;
char
path
[
MAXPATHLEN
];
char
path
[
PATH_MAX
];
struct
lxc_storage
*
bdev
;
struct
lxc_storage
*
bdev
;
FILE
*
fout
;
FILE
*
fout
;
struct
lxc_conf
*
conf
=
c
->
lxc_conf
;
struct
lxc_conf
*
conf
=
c
->
lxc_conf
;
...
@@ -3720,10 +3720,10 @@ static int clone_update_rootfs(struct clone_update_data *data)
...
@@ -3720,10 +3720,10 @@ static int clone_update_rootfs(struct clone_update_data *data)
}
}
if
(
!
(
flags
&
LXC_CLONE_KEEPNAME
))
{
if
(
!
(
flags
&
LXC_CLONE_KEEPNAME
))
{
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/etc/hostname"
,
bdev
->
dest
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/etc/hostname"
,
bdev
->
dest
);
storage_put
(
bdev
);
storage_put
(
bdev
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
-
1
;
return
-
1
;
if
(
!
file_exists
(
path
))
if
(
!
file_exists
(
path
))
...
@@ -3785,7 +3785,7 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
...
@@ -3785,7 +3785,7 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
const
char
*
bdevtype
,
const
char
*
bdevdata
,
uint64_t
newsize
,
const
char
*
bdevtype
,
const
char
*
bdevdata
,
uint64_t
newsize
,
char
**
hookargs
)
char
**
hookargs
)
{
{
char
newpath
[
MAXPATHLEN
];
char
newpath
[
PATH_MAX
];
int
fd
,
ret
;
int
fd
,
ret
;
struct
clone_update_data
data
;
struct
clone_update_data
data
;
size_t
saved_unexp_len
;
size_t
saved_unexp_len
;
...
@@ -3812,8 +3812,8 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
...
@@ -3812,8 +3812,8 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
if
(
!
lxcpath
)
if
(
!
lxcpath
)
lxcpath
=
do_lxcapi_get_config_path
(
c
);
lxcpath
=
do_lxcapi_get_config_path
(
c
);
ret
=
snprintf
(
newpath
,
MAXPATHLEN
,
"%s/%s/config"
,
lxcpath
,
newname
);
ret
=
snprintf
(
newpath
,
PATH_MAX
,
"%s/%s/config"
,
lxcpath
,
newname
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
SYSERROR
(
"clone: failed making config pathname"
);
SYSERROR
(
"clone: failed making config pathname"
);
goto
out
;
goto
out
;
}
}
...
@@ -3861,8 +3861,8 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
...
@@ -3861,8 +3861,8 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
saved_unexp_conf
=
NULL
;
saved_unexp_conf
=
NULL
;
c
->
lxc_conf
->
unexpanded_len
=
saved_unexp_len
;
c
->
lxc_conf
->
unexpanded_len
=
saved_unexp_len
;
ret
=
snprintf
(
newpath
,
MAXPATHLEN
,
"%s/%s/rootfs"
,
lxcpath
,
newname
);
ret
=
snprintf
(
newpath
,
PATH_MAX
,
"%s/%s/rootfs"
,
lxcpath
,
newname
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
SYSERROR
(
"clone: failed making rootfs pathname"
);
SYSERROR
(
"clone: failed making rootfs pathname"
);
goto
out
;
goto
out
;
}
}
...
@@ -4111,13 +4111,13 @@ static bool get_snappath_dir(struct lxc_container *c, char *snappath)
...
@@ -4111,13 +4111,13 @@ static bool get_snappath_dir(struct lxc_container *c, char *snappath)
* If the old style snapshot path exists, use it
* If the old style snapshot path exists, use it
* /var/lib/lxc -> /var/lib/lxcsnaps
* /var/lib/lxc -> /var/lib/lxcsnaps
*/
*/
ret
=
snprintf
(
snappath
,
MAXPATHLEN
,
"%ssnaps"
,
c
->
config_path
);
ret
=
snprintf
(
snappath
,
PATH_MAX
,
"%ssnaps"
,
c
->
config_path
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
if
(
dir_exists
(
snappath
))
{
if
(
dir_exists
(
snappath
))
{
ret
=
snprintf
(
snappath
,
MAXPATHLEN
,
"%ssnaps/%s"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
snappath
,
PATH_MAX
,
"%ssnaps/%s"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
return
true
;
return
true
;
...
@@ -4127,8 +4127,8 @@ static bool get_snappath_dir(struct lxc_container *c, char *snappath)
...
@@ -4127,8 +4127,8 @@ static bool get_snappath_dir(struct lxc_container *c, char *snappath)
* Use the new style path
* Use the new style path
* /var/lib/lxc -> /var/lib/lxc + c->name + /snaps + \0
* /var/lib/lxc -> /var/lib/lxc + c->name + /snaps + \0
*/
*/
ret
=
snprintf
(
snappath
,
MAXPATHLEN
,
"%s/%s/snaps"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
snappath
,
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
;
return
true
;
return
true
;
...
@@ -4140,7 +4140,7 @@ static int do_lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
...
@@ -4140,7 +4140,7 @@ static int do_lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
time_t
timer
;
time_t
timer
;
struct
tm
tm_info
;
struct
tm
tm_info
;
struct
lxc_container
*
c2
;
struct
lxc_container
*
c2
;
char
snappath
[
MAXPATHLEN
],
newname
[
20
];
char
snappath
[
PATH_MAX
],
newname
[
20
];
char
buffer
[
25
];
char
buffer
[
25
];
FILE
*
f
;
FILE
*
f
;
...
@@ -4260,12 +4260,12 @@ static char *get_snapcomment_path(char* snappath, char *name)
...
@@ -4260,12 +4260,12 @@ static char *get_snapcomment_path(char* snappath, char *name)
static
char
*
get_timestamp
(
char
*
snappath
,
char
*
name
)
static
char
*
get_timestamp
(
char
*
snappath
,
char
*
name
)
{
{
char
path
[
MAXPATHLEN
],
*
s
=
NULL
;
char
path
[
PATH_MAX
],
*
s
=
NULL
;
int
ret
,
len
;
int
ret
,
len
;
FILE
*
fin
;
FILE
*
fin
;
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s/ts"
,
snappath
,
name
);
ret
=
snprintf
(
path
,
PATH_MAX
,
"%s/%s/ts"
,
snappath
,
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
NULL
;
return
NULL
;
fin
=
fopen
(
path
,
"r"
);
fin
=
fopen
(
path
,
"r"
);
...
@@ -4293,7 +4293,7 @@ static char *get_timestamp(char* snappath, char *name)
...
@@ -4293,7 +4293,7 @@ static char *get_timestamp(char* snappath, char *name)
static
int
do_lxcapi_snapshot_list
(
struct
lxc_container
*
c
,
struct
lxc_snapshot
**
ret_snaps
)
static
int
do_lxcapi_snapshot_list
(
struct
lxc_container
*
c
,
struct
lxc_snapshot
**
ret_snaps
)
{
{
char
snappath
[
MAXPATHLEN
],
path2
[
MAXPATHLEN
];
char
snappath
[
PATH_MAX
],
path2
[
PATH_MAX
];
int
count
=
0
,
ret
;
int
count
=
0
,
ret
;
struct
dirent
*
direntp
;
struct
dirent
*
direntp
;
struct
lxc_snapshot
*
snaps
=
NULL
,
*
nsnaps
;
struct
lxc_snapshot
*
snaps
=
NULL
,
*
nsnaps
;
...
@@ -4320,8 +4320,8 @@ static int do_lxcapi_snapshot_list(struct lxc_container *c, struct lxc_snapshot
...
@@ -4320,8 +4320,8 @@ static int do_lxcapi_snapshot_list(struct lxc_container *c, struct lxc_snapshot
if
(
!
strcmp
(
direntp
->
d_name
,
".."
))
if
(
!
strcmp
(
direntp
->
d_name
,
".."
))
continue
;
continue
;
ret
=
snprintf
(
path2
,
MAXPATHLEN
,
"%s/%s/config"
,
snappath
,
direntp
->
d_name
);
ret
=
snprintf
(
path2
,
PATH_MAX
,
"%s/%s/config"
,
snappath
,
direntp
->
d_name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"pathname too long"
);
ERROR
(
"pathname too long"
);
goto
out_free
;
goto
out_free
;
}
}
...
@@ -4378,7 +4378,7 @@ WRAP_API_1(int, lxcapi_snapshot_list, struct lxc_snapshot **)
...
@@ -4378,7 +4378,7 @@ WRAP_API_1(int, lxcapi_snapshot_list, struct lxc_snapshot **)
static
bool
do_lxcapi_snapshot_restore
(
struct
lxc_container
*
c
,
const
char
*
snapname
,
const
char
*
newname
)
static
bool
do_lxcapi_snapshot_restore
(
struct
lxc_container
*
c
,
const
char
*
snapname
,
const
char
*
newname
)
{
{
char
clonelxcpath
[
MAXPATHLEN
];
char
clonelxcpath
[
PATH_MAX
];
int
flags
=
0
;
int
flags
=
0
;
struct
lxc_container
*
snap
,
*
rest
;
struct
lxc_container
*
snap
,
*
rest
;
struct
lxc_storage
*
bdev
;
struct
lxc_storage
*
bdev
;
...
@@ -4516,7 +4516,7 @@ static bool remove_all_snapshots(const char *path)
...
@@ -4516,7 +4516,7 @@ static bool remove_all_snapshots(const char *path)
static
bool
do_lxcapi_snapshot_destroy
(
struct
lxc_container
*
c
,
const
char
*
snapname
)
static
bool
do_lxcapi_snapshot_destroy
(
struct
lxc_container
*
c
,
const
char
*
snapname
)
{
{
char
clonelxcpath
[
MAXPATHLEN
];
char
clonelxcpath
[
PATH_MAX
];
if
(
!
c
||
!
c
->
name
||
!
c
->
config_path
||
!
snapname
)
if
(
!
c
||
!
c
->
name
||
!
c
->
config_path
||
!
snapname
)
return
false
;
return
false
;
...
@@ -4531,7 +4531,7 @@ WRAP_API_1(bool, lxcapi_snapshot_destroy, const char *)
...
@@ -4531,7 +4531,7 @@ WRAP_API_1(bool, lxcapi_snapshot_destroy, const char *)
static
bool
do_lxcapi_snapshot_destroy_all
(
struct
lxc_container
*
c
)
static
bool
do_lxcapi_snapshot_destroy_all
(
struct
lxc_container
*
c
)
{
{
char
clonelxcpath
[
MAXPATHLEN
];
char
clonelxcpath
[
PATH_MAX
];
if
(
!
c
||
!
c
->
name
||
!
c
->
config_path
)
if
(
!
c
||
!
c
->
name
||
!
c
->
config_path
)
return
false
;
return
false
;
...
@@ -4560,7 +4560,7 @@ static bool do_add_remove_node(pid_t init_pid, const char *path, bool add,
...
@@ -4560,7 +4560,7 @@ static bool do_add_remove_node(pid_t init_pid, const char *path, bool add,
int
ret
;
int
ret
;
char
*
tmp
;
char
*
tmp
;
pid_t
pid
;
pid_t
pid
;
char
chrootpath
[
MAXPATHLEN
];
char
chrootpath
[
PATH_MAX
];
char
*
directory_path
=
NULL
;
char
*
directory_path
=
NULL
;
pid
=
fork
();
pid
=
fork
();
...
@@ -4580,8 +4580,8 @@ static bool do_add_remove_node(pid_t init_pid, const char *path, bool add,
...
@@ -4580,8 +4580,8 @@ static bool do_add_remove_node(pid_t init_pid, const char *path, bool add,
}
}
/* prepare the path */
/* prepare the path */
ret
=
snprintf
(
chrootpath
,
MAXPATHLEN
,
"/proc/%d/root"
,
init_pid
);
ret
=
snprintf
(
chrootpath
,
PATH_MAX
,
"/proc/%d/root"
,
init_pid
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
return
false
;
return
false
;
ret
=
chroot
(
chrootpath
);
ret
=
chroot
(
chrootpath
);
...
@@ -4974,7 +4974,7 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source,
...
@@ -4974,7 +4974,7 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source,
struct
lxc_mount
*
mnt
)
struct
lxc_mount
*
mnt
)
{
{
char
*
suff
,
*
sret
;
char
*
suff
,
*
sret
;
char
template
[
MAXPATHLEN
],
path
[
MAXPATHLEN
];
char
template
[
PATH_MAX
],
path
[
PATH_MAX
];
pid_t
pid
,
init_pid
;
pid_t
pid
,
init_pid
;
struct
stat
sb
;
struct
stat
sb
;
int
ret
=
-
1
,
fd
=
-
EBADF
;
int
ret
=
-
1
,
fd
=
-
EBADF
;
...
...
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