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
007bb915
Unverified
Commit
007bb915
authored
Feb 05, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lvm: remove stack allocations
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
6b4e204c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
lvm.c
src/lxc/storage/lvm.c
+5
-4
No files found.
src/lxc/storage/lvm.c
View file @
007bb915
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "config.h"
#include "config.h"
#include "log.h"
#include "log.h"
#include "lvm.h"
#include "lvm.h"
#include "memory_utils.h"
#include "rsync.h"
#include "rsync.h"
#include "storage.h"
#include "storage.h"
#include "storage_utils.h"
#include "storage_utils.h"
...
@@ -113,7 +114,7 @@ static int do_lvm_create(const char *path, uint64_t size, const char *thinpool)
...
@@ -113,7 +114,7 @@ static int do_lvm_create(const char *path, uint64_t size, const char *thinpool)
char
*
pathdup
,
*
vg
,
*
lv
;
char
*
pathdup
,
*
vg
,
*
lv
;
char
cmd_output
[
PATH_MAX
];
char
cmd_output
[
PATH_MAX
];
char
sz
[
24
];
char
sz
[
24
];
char
*
tp
=
NULL
;
__do_free
char
*
tp
;
struct
lvcreate_args
cmd_args
=
{
0
};
struct
lvcreate_args
cmd_args
=
{
0
};
ret
=
snprintf
(
sz
,
24
,
"%"
PRIu64
"b"
,
size
);
ret
=
snprintf
(
sz
,
24
,
"%"
PRIu64
"b"
,
size
);
...
@@ -149,7 +150,7 @@ static int do_lvm_create(const char *path, uint64_t size, const char *thinpool)
...
@@ -149,7 +150,7 @@ static int do_lvm_create(const char *path, uint64_t size, const char *thinpool)
if
(
thinpool
)
{
if
(
thinpool
)
{
len
=
strlen
(
pathdup
)
+
strlen
(
thinpool
)
+
2
;
len
=
strlen
(
pathdup
)
+
strlen
(
thinpool
)
+
2
;
tp
=
alloca
(
len
);
tp
=
must_realloc
(
NULL
,
len
);
ret
=
snprintf
(
tp
,
len
,
"%s/%s"
,
pathdup
,
thinpool
);
ret
=
snprintf
(
tp
,
len
,
"%s/%s"
,
pathdup
,
thinpool
);
if
(
ret
<
0
||
ret
>=
len
)
{
if
(
ret
<
0
||
ret
>=
len
)
{
...
@@ -267,15 +268,15 @@ int lvm_umount(struct lxc_storage *bdev)
...
@@ -267,15 +268,15 @@ int lvm_umount(struct lxc_storage *bdev)
#define __LVSCMD "lvs --unbuffered --noheadings -o lv_attr %s 2>/dev/null"
#define __LVSCMD "lvs --unbuffered --noheadings -o lv_attr %s 2>/dev/null"
int
lvm_compare_lv_attr
(
const
char
*
path
,
int
pos
,
const
char
expected
)
int
lvm_compare_lv_attr
(
const
char
*
path
,
int
pos
,
const
char
expected
)
{
{
__do_free
char
*
cmd
;
struct
lxc_popen_FILE
*
f
;
struct
lxc_popen_FILE
*
f
;
int
ret
,
status
;
int
ret
,
status
;
size_t
len
;
size_t
len
;
char
*
cmd
;
char
output
[
12
];
char
output
[
12
];
int
start
=
0
;
int
start
=
0
;
len
=
strlen
(
__LVSCMD
)
+
strlen
(
path
)
+
1
;
len
=
strlen
(
__LVSCMD
)
+
strlen
(
path
)
+
1
;
cmd
=
alloca
(
len
);
cmd
=
must_realloc
(
NULL
,
len
);
ret
=
snprintf
(
cmd
,
len
,
__LVSCMD
,
path
);
ret
=
snprintf
(
cmd
,
len
,
__LVSCMD
,
path
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
len
)
if
(
ret
<
0
||
(
size_t
)
ret
>=
len
)
...
...
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