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
10846a6d
Unverified
Commit
10846a6d
authored
Aug 22, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
string_utils: add remove_trailing_slashes()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
9809fcfc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
10 deletions
+12
-10
initutils.c
src/lxc/initutils.c
+0
-7
initutils.h
src/lxc/initutils.h
+4
-3
string_utils.c
src/lxc/string_utils.c
+7
-0
string_utils.h
src/lxc/string_utils.h
+1
-0
No files found.
src/lxc/initutils.c
View file @
10846a6d
...
...
@@ -217,13 +217,6 @@ out:
return
values
[
i
];
}
extern
void
remove_trailing_slashes
(
char
*
p
)
{
int
l
=
strlen
(
p
);
while
(
--
l
>=
0
&&
(
p
[
l
]
==
'/'
||
p
[
l
]
==
'\n'
))
p
[
l
]
=
'\0'
;
}
/*
* Sets the process title to the specified title. Note that this may fail if
* the kernel doesn't support PR_SET_MM_MAP (kernels <3.18).
...
...
src/lxc/initutils.h
View file @
10846a6d
...
...
@@ -24,6 +24,8 @@
#ifndef __LXC_INITUTILS_H
#define __LXC_INITUTILS_H
#include "config.h"
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
...
...
@@ -31,12 +33,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "
config
.h"
#include "
string_utils
.h"
#define DEFAULT_VG "lxc"
#define DEFAULT_THIN_POOL "lxc"
...
...
@@ -70,7 +72,6 @@ struct prctl_mm_map {
extern
const
char
*
lxc_global_config_value
(
const
char
*
option_name
);
extern
void
remove_trailing_slashes
(
char
*
p
);
extern
int
setproctitle
(
char
*
title
);
#endif
/* __LXC_INITUTILS_H */
src/lxc/string_utils.c
View file @
10846a6d
...
...
@@ -978,3 +978,10 @@ int lxc_is_line_empty(const char *line)
return
0
;
return
1
;
}
void
remove_trailing_slashes
(
char
*
p
)
{
int
l
=
strlen
(
p
);
while
(
--
l
>=
0
&&
(
p
[
l
]
==
'/'
||
p
[
l
]
==
'\n'
))
p
[
l
]
=
'\0'
;
}
src/lxc/string_utils.h
View file @
10846a6d
...
...
@@ -111,5 +111,6 @@ extern int lxc_char_right_gc(const char *buffer, size_t len);
extern
char
*
lxc_trim_whitespace_in_place
(
char
*
buffer
);
extern
int
lxc_is_line_empty
(
const
char
*
line
);
extern
void
remove_trailing_slashes
(
char
*
p
);
#endif
/* __LXC_STRING_UTILS_H */
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