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
8d313ae1
Unverified
Commit
8d313ae1
authored
Jan 12, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: move lxc-console to API symbols only
Closes #2073. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
2e38dc37
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
lxc_console.c
src/lxc/tools/lxc_console.c
+1
-7
tool_utils.c
src/lxc/tools/tool_utils.c
+28
-0
tool_utils.h
src/lxc/tools/tool_utils.h
+1
-0
No files found.
src/lxc/tools/lxc_console.c
View file @
8d313ae1
...
@@ -39,12 +39,7 @@
...
@@ -39,12 +39,7 @@
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
#include "arguments.h"
#include "arguments.h"
#include "commands.h"
#include "tool_utils.h"
#include "error.h"
#include "log.h"
#include "lxc.h"
#include "mainloop.h"
#include "utils.h"
static
char
etoc
(
const
char
*
expr
)
static
char
etoc
(
const
char
*
expr
)
{
{
...
@@ -115,7 +110,6 @@ int main(int argc, char *argv[])
...
@@ -115,7 +110,6 @@ int main(int argc, char *argv[])
ret
=
lxc_log_init
(
&
log
);
ret
=
lxc_log_init
(
&
log
);
if
(
ret
)
if
(
ret
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
lxc_log_options_no_override
();
/* REMOVE IN LXC 3.0 */
/* REMOVE IN LXC 3.0 */
setenv
(
"LXC_UPDATE_CONFIG_FORMAT"
,
"1"
,
0
);
setenv
(
"LXC_UPDATE_CONFIG_FORMAT"
,
"1"
,
0
);
...
...
src/lxc/tools/tool_utils.c
View file @
8d313ae1
...
@@ -17,7 +17,9 @@
...
@@ -17,7 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
*/
#define _GNU_SOURCE
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#include <ctype.h>
#include <errno.h>
#include <errno.h>
#include <limits.h>
#include <limits.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -310,6 +312,32 @@ again:
...
@@ -310,6 +312,32 @@ again:
return
status
;
return
status
;
}
}
int
lxc_safe_uint
(
const
char
*
numstr
,
unsigned
int
*
converted
)
{
char
*
err
=
NULL
;
unsigned
long
int
uli
;
while
(
isspace
(
*
numstr
))
numstr
++
;
if
(
*
numstr
==
'-'
)
return
-
EINVAL
;
errno
=
0
;
uli
=
strtoul
(
numstr
,
&
err
,
0
);
if
(
errno
==
ERANGE
&&
uli
==
ULONG_MAX
)
return
-
ERANGE
;
if
(
err
==
numstr
||
*
err
!=
'\0'
)
return
-
EINVAL
;
if
(
uli
>
UINT_MAX
)
return
-
ERANGE
;
*
converted
=
(
unsigned
int
)
uli
;
return
0
;
}
int
lxc_safe_int
(
const
char
*
numstr
,
int
*
converted
)
int
lxc_safe_int
(
const
char
*
numstr
,
int
*
converted
)
{
{
char
*
err
=
NULL
;
char
*
err
=
NULL
;
...
...
src/lxc/tools/tool_utils.h
View file @
8d313ae1
...
@@ -125,6 +125,7 @@ static inline int lxc_caps_init(void) {
...
@@ -125,6 +125,7 @@ static inline int lxc_caps_init(void) {
extern
int
wait_for_pid
(
pid_t
pid
);
extern
int
wait_for_pid
(
pid_t
pid
);
extern
int
lxc_wait_for_pid_status
(
pid_t
pid
);
extern
int
lxc_wait_for_pid_status
(
pid_t
pid
);
extern
int
lxc_safe_uint
(
const
char
*
numstr
,
unsigned
int
*
converted
);
extern
int
lxc_safe_int
(
const
char
*
numstr
,
int
*
converted
);
extern
int
lxc_safe_int
(
const
char
*
numstr
,
int
*
converted
);
extern
int
lxc_safe_long
(
const
char
*
numstr
,
long
int
*
converted
);
extern
int
lxc_safe_long
(
const
char
*
numstr
,
long
int
*
converted
);
...
...
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