if ((options->namespaces & CLONE_NEWNS) &&
(options->attach_flags & LXC_ATTACH_LSM) &&
init_ctx->lsm_label) {
- int ret = -1;
int labelfd;
bool on_exec;
+ ret = -1;
on_exec = options->attach_flags & LXC_ATTACH_LSM_EXEC ? true : false;
labelfd = lsm_process_label_fd_get(attached_pid, on_exec);
if (labelfd < 0)
free(me);
if (request == LXC_USERNIC_DELETE) {
- int ret;
struct alloted_s *it;
bool found_nicname = false;
}
while (getline(&line, &len, f) != -1) {
- int ret;
char *opts, *target;
target = get_field(line, 4);
rmdir(rootfs->mount);
goto out_fini_handler;
} else {
- int ret;
char title[2048];
close(pipes[1]);
int status;
ssize_t n;
char buf[4096];
- bool ret;
close(criuout[1]);
char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \
char *ptr = NULL; \
{ \
- int saved_errno = errno; \
+ int __saved_errno = errno; \
ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \
- errno = saved_errno; \
+ errno = __saved_errno; \
if (!ptr) \
ptr = errno_buf; \
}
char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \
char *ptr = errno_buf; \
{ \
- int saved_errno = errno; \
+ int __saved_errno = errno; \
(void)strerror_r(errno, errno_buf, sizeof(errno_buf)); \
- errno = saved_errno; \
+ errno = __saved_errno; \
}
#endif
#elif ENFORCE_THREAD_SAFETY
* right PID.
*/
if (c->pidfile) {
- int ret, w;
+ int w;
char pidstr[INTTYPE_TO_STRLEN(pid_t)];
w = snprintf(pidstr, sizeof(pidstr), "%d", lxc_raw_getpid());
if (pid == 0) {
ssize_t nbytes;
char addressOutputBuffer[INET6_ADDRSTRLEN];
- int ret = 1;
- char *address = NULL;
+ char *address_ptr = NULL;
void *tempAddrPtr = NULL;
struct netns_ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
else if (!interface && strcmp("lo", tempIfAddr->ifa_name) == 0)
continue;
- address = (char *)inet_ntop(tempIfAddr->ifa_addr->sa_family,
+ address_ptr = (char *)inet_ntop(tempIfAddr->ifa_addr->sa_family,
tempAddrPtr, addressOutputBuffer,
sizeof(addressOutputBuffer));
- if (!address)
+ if (!address_ptr)
continue;
- nbytes = lxc_write_nointr(pipefd[1], address, INET6_ADDRSTRLEN);
+ nbytes = lxc_write_nointr(pipefd[1], address_ptr, INET6_ADDRSTRLEN);
if (nbytes != INET6_ADDRSTRLEN) {
SYSERROR("Failed to send ipv6 address \"%s\"",
- address);
+ address_ptr);
goto out;
}
}
if (child == 0) {
- int ret;
- size_t retlen;
char pidstr[INTTYPE_TO_STRLEN(pid_t)];
close(pipefd[0]);
if (child == 0) {
char *hostveth;
- int ret;
close(pipefd[0]);
/* set the network device up */
if (netdev->flags & IFF_UP) {
- int err;
-
err = lxc_netdev_up(current_ifname);
if (err) {
errno = -err;
if (strcmp(orig->type, "dir") == 0) {
char *delta, *lastslash;
char *work;
- int ret, len, lastslashidx;
+ int len, lastslashidx;
/* If we have "/var/lib/lxc/c2/rootfs" then delta will be
* "/var/lib/lxc/c2/delta0".
char *clean_old_path, *clean_new_path;
char *lastslash, *ndelta, *nsrc, *odelta, *osrc, *s1, *s2, *s3,
*work;
- int ret, lastslashidx;
+ int lastslashidx;
size_t len, name_len;
osrc = strdup(orig->src);
}
if (!orig->dest) {
- int ret;
size_t len;
struct stat sb;
orig_src = lxc_storage_get_path(orig->src, orig->type);
if (!strcmp(orig->type, "zfs")) {
- size_t len;
if (*orig_src == '/') {
bool found;
* "<lxcpath>/<lxcname>/rootfs" is given.
*/
if (*src == '/') {
- char *tmp;
-
found = zfs_list_entry(src, cmd_output, sizeof(cmd_output));
if (!found) {
ERROR("Failed to find zfs entry \"%s\"", orig->src);
}
}
-static void print_info_msg_int(const char *key, int value)
+static void print_info_msg_int(const char *k, int value)
{
if (humanize)
- printf("%-15s %d\n", key, value);
+ printf("%-15s %d\n", k, value);
else {
if (filter_count == 1)
printf("%d\n", value);
else
- printf("%-15s %d\n", key, value);
+ printf("%-15s %d\n", k, value);
}
fflush(stdout);
}
-static void print_info_msg_str(const char *key, const char *value)
+static void print_info_msg_str(const char *k, const char *value)
{
if (humanize)
- printf("%-15s %s\n", key, value);
+ printf("%-15s %s\n", k, value);
else {
if (filter_count == 1)
printf("%s\n", value);
else
- printf("%-15s %s\n", key, value);
+ printf("%-15s %s\n", k, value);
}
fflush(stdout);
}
l->unprivileged = !(val == NULL);
free(val);
} else {
- int ret;
-
ret = c->get_config_item(c, "lxc.idmap", NULL, 0);
l->unprivileged = !(ret == 0);
}
static int my_parser(struct lxc_arguments *args, int c, char *arg);
static inline int sethostname_including_android(const char *name, size_t len);
static int get_namespace_flags(char *namespaces);
-static bool lookup_user(const char *optarg, uid_t *uid);
+static bool lookup_user(const char *oparg, uid_t *uid);
static int mount_fs(const char *source, const char *target, const char *type);
static void lxc_setup_fs(void);
static int do_start(void *arg);
return flags;
}
-static bool lookup_user(const char *optarg, uid_t *uid)
+static bool lookup_user(const char *oparg, uid_t *uid)
{
char name[PATH_MAX];
struct passwd pwent;
size_t bufsize;
int ret;
- if (!optarg || (optarg[0] == '\0'))
+ if (!oparg || (oparg[0] == '\0'))
return false;
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
if (!buf)
return false;
- if (sscanf(optarg, "%u", uid) < 1) {
+ if (sscanf(oparg, "%u", uid) < 1) {
/* not a uid -- perhaps a username */
- if (sscanf(optarg, "%s", name) < 1) {
+ if (sscanf(oparg, "%s", name) < 1) {
free(buf);
return false;
}
if (lxc_list_len(&ifnames) > 0) {
struct lxc_list *iterator;
char* ifname;
- pid_t pid;
+ pid_t lpid;
lxc_list_for_each(iterator, &ifnames) {
ifname = iterator->elem;
if (!ifname)
continue;
- pid = fork();
- if (pid < 0) {
+ lpid = fork();
+ if (lpid < 0) {
SYSERROR("Failed to move network device \"%s\" to network namespace",
ifname);
continue;
}
- if (pid == 0) {
+ if (lpid == 0) {
char buf[256];
- ret = snprintf(buf, 256, "%d", pid);
+ ret = snprintf(buf, 256, "%d", lpid);
if (ret < 0 || ret >= 256)
_exit(EXIT_FAILURE);
_exit(EXIT_FAILURE);
}
- if (wait_for_pid(pid) != 0)
+ if (wait_for_pid(lpid) != 0)
SYSERROR("Could not move interface \"%s\" into container %d",
- ifname, pid);
+ ifname, lpid);
}
free_ifname_list();
lxc_debug("Starting namespace sharing test iteration %d\n", j);
for (i = 0; i < 10; i++) {
- int ret;
-
args[i].thread_id = i;
args[i].success = false;
args[i].init_pid = init_pid;
}
for (i = 0; i < 10; i++) {
- int ret;
-
ret = pthread_join(threads[i], NULL);
if (ret != 0)
goto on_error_stop;
sleep(5);
for (i = 0; i < 10; i++) {
- int ret;
-
args[i].thread_id = i;
args[i].c = c;
args[i].timeout = -1;
}
for (i = 0; i < 10; i++) {
- int ret;
-
ret = pthread_join(threads[i], NULL);
if (ret != 0)
goto on_error_stop;