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
b51eb5ca
Commit
b51eb5ca
authored
Jul 02, 2017
by
Christian Brauner
Committed by
GitHub
Jul 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1667 from 0x0916/2017-07-02/fix-cppcheck-warnings
fix some cppcheck warnings
parents
26b9df9d
6fc7d8b6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
cgfs.c
src/lxc/cgroups/cgfs.c
+1
-1
confile.c
src/lxc/confile.c
+2
-2
confile_legacy.c
src/lxc/confile_legacy.c
+2
-2
lxclock.c
src/lxc/lxclock.c
+1
-1
lxc_info.c
src/lxc/tools/lxc_info.c
+5
-5
lxc_top.c
src/lxc/tools/lxc_top.c
+8
-8
No files found.
src/lxc/cgroups/cgfs.c
View file @
b51eb5ca
...
@@ -791,7 +791,7 @@ static char *cgroup_rename_nsgroup(const char *mountpath, const char *oldname, p
...
@@ -791,7 +791,7 @@ static char *cgroup_rename_nsgroup(const char *mountpath, const char *oldname, p
len
=
strlen
(
oldname
)
+
strlen
(
mountpath
)
+
22
;
len
=
strlen
(
oldname
)
+
strlen
(
mountpath
)
+
22
;
fulloldpath
=
alloca
(
len
);
fulloldpath
=
alloca
(
len
);
ret
=
snprintf
(
fulloldpath
,
len
,
"%s/%s/%l
d
"
,
mountpath
,
oldname
,
(
unsigned
long
)
pid
);
ret
=
snprintf
(
fulloldpath
,
len
,
"%s/%s/%l
u
"
,
mountpath
,
oldname
,
(
unsigned
long
)
pid
);
if
(
ret
<
0
||
ret
>=
len
)
if
(
ret
<
0
||
ret
>=
len
)
return
NULL
;
return
NULL
;
...
...
src/lxc/confile.c
View file @
b51eb5ca
...
@@ -4437,7 +4437,7 @@ static int get_config_net_ipv4(const char *key, char *retv, int inlen,
...
@@ -4437,7 +4437,7 @@ static int get_config_net_ipv4(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
netdev
->
ipv4
)
{
lxc_list_for_each
(
it
,
&
netdev
->
ipv4
)
{
struct
lxc_inetdev
*
i
=
it
->
elem
;
struct
lxc_inetdev
*
i
=
it
->
elem
;
inet_ntop
(
AF_INET
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
inet_ntop
(
AF_INET
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
strprint
(
retv
,
inlen
,
"%s/%
d
%s"
,
buf
,
i
->
prefix
,
strprint
(
retv
,
inlen
,
"%s/%
u
%s"
,
buf
,
i
->
prefix
,
(
listlen
--
>
1
)
?
"
\n
"
:
""
);
(
listlen
--
>
1
)
?
"
\n
"
:
""
);
}
}
...
@@ -4498,7 +4498,7 @@ static int get_config_net_ipv6(const char *key, char *retv, int inlen,
...
@@ -4498,7 +4498,7 @@ static int get_config_net_ipv6(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
netdev
->
ipv6
)
{
lxc_list_for_each
(
it
,
&
netdev
->
ipv6
)
{
struct
lxc_inet6dev
*
i
=
it
->
elem
;
struct
lxc_inet6dev
*
i
=
it
->
elem
;
inet_ntop
(
AF_INET6
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
inet_ntop
(
AF_INET6
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
strprint
(
retv
,
inlen
,
"%s/%
d
%s"
,
buf
,
i
->
prefix
,
strprint
(
retv
,
inlen
,
"%s/%
u
%s"
,
buf
,
i
->
prefix
,
(
listlen
--
>
1
)
?
"
\n
"
:
""
);
(
listlen
--
>
1
)
?
"
\n
"
:
""
);
}
}
...
...
src/lxc/confile_legacy.c
View file @
b51eb5ca
...
@@ -918,7 +918,7 @@ int get_config_network_legacy_item(const char *key, char *retv, int inlen,
...
@@ -918,7 +918,7 @@ int get_config_network_legacy_item(const char *key, char *retv, int inlen,
struct
lxc_inetdev
*
i
=
it2
->
elem
;
struct
lxc_inetdev
*
i
=
it2
->
elem
;
char
buf
[
INET_ADDRSTRLEN
];
char
buf
[
INET_ADDRSTRLEN
];
inet_ntop
(
AF_INET
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
inet_ntop
(
AF_INET
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
strprint
(
retv
,
inlen
,
"%s/%
d
\n
"
,
buf
,
i
->
prefix
);
strprint
(
retv
,
inlen
,
"%s/%
u
\n
"
,
buf
,
i
->
prefix
);
}
}
}
else
if
(
strcmp
(
p1
,
"ipv6.gateway"
)
==
0
)
{
}
else
if
(
strcmp
(
p1
,
"ipv6.gateway"
)
==
0
)
{
if
(
netdev
->
ipv6_gateway_auto
)
{
if
(
netdev
->
ipv6_gateway_auto
)
{
...
@@ -935,7 +935,7 @@ int get_config_network_legacy_item(const char *key, char *retv, int inlen,
...
@@ -935,7 +935,7 @@ int get_config_network_legacy_item(const char *key, char *retv, int inlen,
struct
lxc_inet6dev
*
i
=
it2
->
elem
;
struct
lxc_inet6dev
*
i
=
it2
->
elem
;
char
buf
[
INET6_ADDRSTRLEN
];
char
buf
[
INET6_ADDRSTRLEN
];
inet_ntop
(
AF_INET6
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
inet_ntop
(
AF_INET6
,
&
i
->
addr
,
buf
,
sizeof
(
buf
));
strprint
(
retv
,
inlen
,
"%s/%
d
\n
"
,
buf
,
i
->
prefix
);
strprint
(
retv
,
inlen
,
"%s/%
u
\n
"
,
buf
,
i
->
prefix
);
}
}
}
}
return
fulllen
;
return
fulllen
;
...
...
src/lxc/lxclock.c
View file @
b51eb5ca
...
@@ -55,7 +55,7 @@ static inline void dump_stacktrace(void)
...
@@ -55,7 +55,7 @@ static inline void dump_stacktrace(void)
strings
=
backtrace_symbols
(
array
,
size
);
strings
=
backtrace_symbols
(
array
,
size
);
// Using fprintf here as our logging module is not thread safe
// Using fprintf here as our logging module is not thread safe
fprintf
(
stderr
,
"
\t
Obtained %z
d
stack frames.
\n
"
,
size
);
fprintf
(
stderr
,
"
\t
Obtained %z
u
stack frames.
\n
"
,
size
);
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
i
=
0
;
i
<
size
;
i
++
)
fprintf
(
stderr
,
"
\t\t
%s
\n
"
,
strings
[
i
]);
fprintf
(
stderr
,
"
\t\t
%s
\n
"
,
strings
[
i
]);
...
...
src/lxc/tools/lxc_info.c
View file @
b51eb5ca
...
@@ -116,18 +116,18 @@ static void size_humanize(unsigned long long val, char *buf, size_t bufsz)
...
@@ -116,18 +116,18 @@ static void size_humanize(unsigned long long val, char *buf, size_t bufsz)
{
{
if
(
val
>
1
<<
30
)
{
if
(
val
>
1
<<
30
)
{
snprintf
(
buf
,
bufsz
,
"%u.%2.2u GiB"
,
snprintf
(
buf
,
bufsz
,
"%u.%2.2u GiB"
,
(
int
)(
val
>>
30
),
(
unsigned
int
)(
val
>>
30
),
(
int
)(
val
&
((
1
<<
30
)
-
1
))
/
10737419
);
(
unsigned
int
)(
val
&
((
1
<<
30
)
-
1
))
/
10737419
);
}
else
if
(
val
>
1
<<
20
)
{
}
else
if
(
val
>
1
<<
20
)
{
int
x
=
val
+
5243
;
/* for rounding */
unsigned
int
x
=
val
+
5243
;
/* for rounding */
snprintf
(
buf
,
bufsz
,
"%u.%2.2u MiB"
,
snprintf
(
buf
,
bufsz
,
"%u.%2.2u MiB"
,
x
>>
20
,
((
x
&
((
1
<<
20
)
-
1
))
*
100
)
>>
20
);
x
>>
20
,
((
x
&
((
1
<<
20
)
-
1
))
*
100
)
>>
20
);
}
else
if
(
val
>
1
<<
10
)
{
}
else
if
(
val
>
1
<<
10
)
{
int
x
=
val
+
5
;
/* for rounding */
unsigned
int
x
=
val
+
5
;
/* for rounding */
snprintf
(
buf
,
bufsz
,
"%u.%2.2u KiB"
,
snprintf
(
buf
,
bufsz
,
"%u.%2.2u KiB"
,
x
>>
10
,
((
x
&
((
1
<<
10
)
-
1
))
*
100
)
>>
10
);
x
>>
10
,
((
x
&
((
1
<<
10
)
-
1
))
*
100
)
>>
10
);
}
else
{
}
else
{
snprintf
(
buf
,
bufsz
,
"%u bytes"
,
(
int
)
val
);
snprintf
(
buf
,
bufsz
,
"%u bytes"
,
(
unsigned
int
)
val
);
}
}
}
}
...
...
src/lxc/tools/lxc_top.c
View file @
b51eb5ca
...
@@ -209,19 +209,19 @@ static void sig_handler(int sig)
...
@@ -209,19 +209,19 @@ static void sig_handler(int sig)
static
void
size_humanize
(
unsigned
long
long
val
,
char
*
buf
,
size_t
bufsz
)
static
void
size_humanize
(
unsigned
long
long
val
,
char
*
buf
,
size_t
bufsz
)
{
{
if
(
val
>
1
<<
30
)
{
if
(
val
>
1
<<
30
)
{
snprintf
(
buf
,
bufsz
,
"%u.%2.2u GB"
,
snprintf
(
buf
,
bufsz
,
"%u.%2.2u G
i
B"
,
(
int
)(
val
>>
30
),
(
unsigned
int
)(
val
>>
30
),
(
int
)(
val
&
((
1
<<
30
)
-
1
))
/
10737419
);
(
unsigned
int
)(
val
&
((
1
<<
30
)
-
1
))
/
10737419
);
}
else
if
(
val
>
1
<<
20
)
{
}
else
if
(
val
>
1
<<
20
)
{
int
x
=
val
+
5243
;
/* for rounding */
unsigned
int
x
=
val
+
5243
;
/* for rounding */
snprintf
(
buf
,
bufsz
,
"%u.%2.2u MB"
,
snprintf
(
buf
,
bufsz
,
"%u.%2.2u M
i
B"
,
x
>>
20
,
((
x
&
((
1
<<
20
)
-
1
))
*
100
)
>>
20
);
x
>>
20
,
((
x
&
((
1
<<
20
)
-
1
))
*
100
)
>>
20
);
}
else
if
(
val
>
1
<<
10
)
{
}
else
if
(
val
>
1
<<
10
)
{
int
x
=
val
+
5
;
/* for rounding */
unsigned
int
x
=
val
+
5
;
/* for rounding */
snprintf
(
buf
,
bufsz
,
"%u.%2.2u KB"
,
snprintf
(
buf
,
bufsz
,
"%u.%2.2u K
i
B"
,
x
>>
10
,
((
x
&
((
1
<<
10
)
-
1
))
*
100
)
>>
10
);
x
>>
10
,
((
x
&
((
1
<<
10
)
-
1
))
*
100
)
>>
10
);
}
else
{
}
else
{
snprintf
(
buf
,
bufsz
,
"%3u.00 "
,
(
int
)
val
);
snprintf
(
buf
,
bufsz
,
"%3u.00 "
,
(
unsigned
int
)
val
);
}
}
}
}
...
...
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