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
97bc2422
Unverified
Commit
97bc2422
authored
Jan 04, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree-wide: Sic semper assertis!
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f290a806
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
15 deletions
+27
-15
console.c
src/lxc/console.c
+6
-3
criu.c
src/lxc/criu.c
+0
-1
log.c
src/lxc/log.c
+2
-2
lxccontainer.c
src/lxc/lxccontainer.c
+7
-3
lxc_attach.c
src/lxc/tools/lxc_attach.c
+4
-3
utils.c
src/lxc/utils.c
+8
-3
No files found.
src/lxc/console.c
View file @
97bc2422
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include <assert.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <signal.h>
#include <signal.h>
...
@@ -577,7 +576,9 @@ int lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata,
...
@@ -577,7 +576,9 @@ int lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata,
struct
lxc_tty_state
*
ts
=
cbdata
;
struct
lxc_tty_state
*
ts
=
cbdata
;
char
c
;
char
c
;
assert
(
fd
==
ts
->
stdinfd
);
if
(
fd
!=
ts
->
stdinfd
)
return
1
;
if
(
lxc_read_nointr
(
ts
->
stdinfd
,
&
c
,
1
)
<=
0
)
if
(
lxc_read_nointr
(
ts
->
stdinfd
,
&
c
,
1
)
<=
0
)
return
1
;
return
1
;
...
@@ -607,7 +608,9 @@ int lxc_console_cb_tty_master(int fd, uint32_t events, void *cbdata,
...
@@ -607,7 +608,9 @@ int lxc_console_cb_tty_master(int fd, uint32_t events, void *cbdata,
char
buf
[
1024
];
char
buf
[
1024
];
int
r
,
w
;
int
r
,
w
;
assert
(
fd
==
ts
->
masterfd
);
if
(
fd
!=
ts
->
masterfd
)
return
1
;
r
=
lxc_read_nointr
(
fd
,
buf
,
sizeof
(
buf
));
r
=
lxc_read_nointr
(
fd
,
buf
,
sizeof
(
buf
));
if
(
r
<=
0
)
if
(
r
<=
0
)
return
1
;
return
1
;
...
...
src/lxc/criu.c
View file @
97bc2422
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <assert.h>
#include <inttypes.h>
#include <inttypes.h>
#include <linux/limits.h>
#include <linux/limits.h>
#include <sched.h>
#include <sched.h>
...
...
src/lxc/log.c
View file @
97bc2422
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#define _GNU_SOURCE
#define _GNU_SOURCE
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#include <assert.h>
#include <stdint.h>
#include <stdint.h>
#include <stdio.h>
#include <stdio.h>
#include <errno.h>
#include <errno.h>
...
@@ -470,7 +469,8 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
...
@@ -470,7 +469,8 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
lxc_log_close
();
lxc_log_close
();
}
}
assert
(
fname
!=
NULL
);
if
(
!
fname
)
return
-
1
;
if
(
strlen
(
fname
)
==
0
)
{
if
(
strlen
(
fname
)
==
0
)
{
log_fname
=
NULL
;
log_fname
=
NULL
;
...
...
src/lxc/lxccontainer.c
View file @
97bc2422
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
*/
*/
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <assert.h>
#include <dirent.h>
#include <dirent.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
...
@@ -4319,7 +4318,7 @@ int list_active_containers(const char *lxcpath, char ***nret,
...
@@ -4319,7 +4318,7 @@ int list_active_containers(const char *lxcpath, char ***nret,
char
*
line
=
NULL
;
char
*
line
=
NULL
;
char
**
ct_name
=
NULL
;
char
**
ct_name
=
NULL
;
size_t
len
=
0
;
size_t
len
=
0
;
struct
lxc_container
*
c
;
struct
lxc_container
*
c
=
NULL
;
bool
is_hashed
;
bool
is_hashed
;
if
(
!
lxcpath
)
if
(
!
lxcpath
)
...
@@ -4402,7 +4401,12 @@ int list_active_containers(const char *lxcpath, char ***nret,
...
@@ -4402,7 +4401,12 @@ int list_active_containers(const char *lxcpath, char ***nret,
cret_cnt
++
;
cret_cnt
++
;
}
}
assert
(
!
nret
||
!
cret
||
cret_cnt
==
ct_name_cnt
);
if
(
nret
&&
cret
&&
cret_cnt
!=
ct_name_cnt
)
{
if
(
c
)
lxc_container_put
(
c
);
goto
free_cret_list
;
}
ret
=
ct_name_cnt
;
ret
=
ct_name_cnt
;
if
(
nret
)
if
(
nret
)
*
nret
=
ct_name
;
*
nret
=
ct_name
;
...
...
src/lxc/tools/lxc_attach.c
View file @
97bc2422
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include "config.h"
#include "config.h"
#include <assert.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -83,7 +82,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value)
...
@@ -83,7 +82,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value)
{
{
ssize_t
count
=
0
;
ssize_t
count
=
0
;
assert
(
array
);
if
(
!
array
)
return
-
1
;
if
(
*
array
)
if
(
*
array
)
for
(;
(
*
array
)[
count
];
count
++
);
for
(;
(
*
array
)[
count
];
count
++
);
...
@@ -99,7 +99,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value)
...
@@ -99,7 +99,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value)
*
capacity
=
new_capacity
;
*
capacity
=
new_capacity
;
}
}
assert
(
*
array
);
if
(
!
(
*
array
))
return
-
1
;
(
*
array
)[
count
]
=
value
;
(
*
array
)[
count
]
=
value
;
return
0
;
return
0
;
...
...
src/lxc/utils.c
View file @
97bc2422
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include "config.h"
#include "config.h"
#include <assert.h>
#include <dirent.h>
#include <dirent.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
...
@@ -639,10 +638,16 @@ char *lxc_string_replace(const char *needle, const char *replacement, const char
...
@@ -639,10 +638,16 @@ char *lxc_string_replace(const char *needle, const char *replacement, const char
/* make sure we did the same thing twice,
/* make sure we did the same thing twice,
* once for calculating length, the other
* once for calculating length, the other
* time for copying data */
* time for copying data */
assert
(
saved_len
==
len
);
if
(
saved_len
!=
len
)
{
free
(
result
);
return
NULL
;
}
/* make sure we didn't overwrite any buffer,
/* make sure we didn't overwrite any buffer,
* due to calloc the string should be 0-terminated */
* due to calloc the string should be 0-terminated */
assert
(
result
[
len
]
==
'\0'
);
if
(
result
[
len
]
!=
'\0'
)
{
free
(
result
);
return
NULL
;
}
return
result
;
return
result
;
}
}
...
...
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