* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
struct lxc_tty_state *ts = cbdata;
char c;
- assert(fd == ts->stdinfd);
+ if (fd != ts->stdinfd)
+ return 1;
+
if (lxc_read_nointr(ts->stdinfd, &c, 1) <= 0)
return 1;
char buf[1024];
int r, w;
- assert(fd == ts->masterfd);
+ if (fd != ts->masterfd)
+ return 1;
+
r = lxc_read_nointr(fd, buf, sizeof(buf));
if (r <= 0)
return 1;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <linux/limits.h>
#include <sched.h>
#define _GNU_SOURCE
#define __STDC_FORMAT_MACROS /* Required for PRIu64 to work. */
-#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
lxc_log_close();
}
- assert(fname != NULL);
+ if (!fname)
+ return -1;
if (strlen(fname) == 0) {
log_fname = NULL;
*/
#define _GNU_SOURCE
-#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
char *line = NULL;
char **ct_name = NULL;
size_t len = 0;
- struct lxc_container *c;
+ struct lxc_container *c = NULL;
bool is_hashed;
if (!lxcpath)
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;
if (nret)
*nret = ct_name;
#include "config.h"
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
{
ssize_t count = 0;
- assert(array);
+ if (!array)
+ return -1;
if (*array)
for (; (*array)[count]; count++);
*capacity = new_capacity;
}
- assert(*array);
+ if (!(*array))
+ return -1;
(*array)[count] = value;
return 0;
#include "config.h"
-#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
/* make sure we did the same thing twice,
* once for calculating length, the other
* time for copying data */
- assert(saved_len == len);
+ if (saved_len != len) {
+ free(result);
+ return NULL;
+ }
/* make sure we didn't overwrite any buffer,
* due to calloc the string should be 0-terminated */
- assert(result[len] == '\0');
+ if (result[len] != '\0') {
+ free(result);
+ return NULL;
+ }
return result;
}