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
7ad37670
Unverified
Commit
7ad37670
authored
May 24, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: add remove_trailing_newlines()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
ccf8d128
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
21 deletions
+16
-21
lxccontainer.c
src/lxc/lxccontainer.c
+4
-11
seccomp.c
src/lxc/seccomp.c
+0
-10
utils.c
src/lxc/utils.c
+11
-0
utils.h
src/lxc/utils.h
+1
-0
No files found.
src/lxc/lxccontainer.c
View file @
7ad37670
...
@@ -2685,15 +2685,6 @@ out:
...
@@ -2685,15 +2685,6 @@ out:
return
bret
;
return
bret
;
}
}
static
void
strip_newline
(
char
*
p
)
{
size_t
len
=
strlen
(
p
);
if
(
len
<
1
)
return
;
if
(
p
[
len
-
1
]
==
'\n'
)
p
[
len
-
1
]
=
'\0'
;
}
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
;
...
@@ -2716,8 +2707,10 @@ void mod_all_rdeps(struct lxc_container *c, bool inc)
...
@@ -2716,8 +2707,10 @@ void mod_all_rdeps(struct lxc_container *c, bool inc)
ERROR
(
"badly formatted file %s"
,
path
);
ERROR
(
"badly formatted file %s"
,
path
);
goto
out
;
goto
out
;
}
}
strip_newline
(
lxcpath
);
strip_newline
(
lxcname
);
remove_trailing_newlines
(
lxcpath
);
remove_trailing_newlines
(
lxcname
);
if
((
p
=
lxc_container_new
(
lxcname
,
lxcpath
))
==
NULL
)
{
if
((
p
=
lxc_container_new
(
lxcname
,
lxcpath
))
==
NULL
)
{
ERROR
(
"Unable to find dependent container %s:%s"
,
ERROR
(
"Unable to find dependent container %s:%s"
,
lxcpath
,
lxcname
);
lxcpath
,
lxcname
);
...
...
src/lxc/seccomp.c
View file @
7ad37670
...
@@ -65,16 +65,6 @@ static int parse_config_v1(FILE *f, struct lxc_conf *conf)
...
@@ -65,16 +65,6 @@ static int parse_config_v1(FILE *f, struct lxc_conf *conf)
}
}
#if HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH
#if HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH
static
void
remove_trailing_newlines
(
char
*
l
)
{
char
*
p
=
l
;
while
(
*
p
)
p
++
;
while
(
--
p
>=
l
&&
*
p
==
'\n'
)
*
p
=
'\0'
;
}
static
uint32_t
get_v2_default_action
(
char
*
line
)
static
uint32_t
get_v2_default_action
(
char
*
line
)
{
{
uint32_t
ret_action
=
-
1
;
uint32_t
ret_action
=
-
1
;
...
...
src/lxc/utils.c
View file @
7ad37670
...
@@ -2533,3 +2533,14 @@ int lxc_set_death_signal(int signal)
...
@@ -2533,3 +2533,14 @@ int lxc_set_death_signal(int signal)
return
0
;
return
0
;
}
}
void
remove_trailing_newlines
(
char
*
l
)
{
char
*
p
=
l
;
while
(
*
p
)
p
++
;
while
(
--
p
>=
l
&&
*
p
==
'\n'
)
*
p
=
'\0'
;
}
src/lxc/utils.h
View file @
7ad37670
...
@@ -453,6 +453,7 @@ extern void lxc_free_array(void **array, lxc_free_fn element_free_fn);
...
@@ -453,6 +453,7 @@ extern void lxc_free_array(void **array, lxc_free_fn element_free_fn);
extern
size_t
lxc_array_len
(
void
**
array
);
extern
size_t
lxc_array_len
(
void
**
array
);
extern
void
**
lxc_append_null_to_array
(
void
**
array
,
size_t
count
);
extern
void
**
lxc_append_null_to_array
(
void
**
array
,
size_t
count
);
extern
void
remove_trailing_newlines
(
char
*
l
);
/* initialize rand with urandom */
/* initialize rand with urandom */
extern
int
randseed
(
bool
);
extern
int
randseed
(
bool
);
...
...
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