log: Drop trailing \n from log messages

parent 74f052dd
...@@ -485,11 +485,11 @@ static int dir_create(struct bdev *bdev, const char *dest, const char *n, ...@@ -485,11 +485,11 @@ static int dir_create(struct bdev *bdev, const char *dest, const char *n,
} }
if (mkdir_p(bdev->src, 0755) < 0) { if (mkdir_p(bdev->src, 0755) < 0) {
ERROR("Error creating %s\n", bdev->src); ERROR("Error creating %s", bdev->src);
return -1; return -1;
} }
if (mkdir_p(bdev->dest, 0755) < 0) { if (mkdir_p(bdev->dest, 0755) < 0) {
ERROR("Error creating %s\n", bdev->dest); ERROR("Error creating %s", bdev->dest);
return -1; return -1;
} }
...@@ -1148,7 +1148,7 @@ static int lvm_create(struct bdev *bdev, const char *dest, const char *n, ...@@ -1148,7 +1148,7 @@ static int lvm_create(struct bdev *bdev, const char *dest, const char *n,
return -1; return -1;
if (mkdir_p(bdev->dest, 0755) < 0) { if (mkdir_p(bdev->dest, 0755) < 0) {
ERROR("Error creating %s\n", bdev->dest); ERROR("Error creating %s", bdev->dest);
return -1; return -1;
} }
...@@ -1410,7 +1410,7 @@ static int btrfs_clonepaths(struct bdev *orig, struct bdev *new, const char *old ...@@ -1410,7 +1410,7 @@ static int btrfs_clonepaths(struct bdev *orig, struct bdev *new, const char *old
return btrfs_snapshot(orig->dest, new->dest); return btrfs_snapshot(orig->dest, new->dest);
if (rmdir(new->dest) < 0 && errno != -ENOENT) { if (rmdir(new->dest) < 0 && errno != -ENOENT) {
SYSERROR("removing %s\n", new->dest); SYSERROR("removing %s", new->dest);
return -1; return -1;
} }
...@@ -1540,7 +1540,7 @@ static int loop_mount(struct bdev *bdev) ...@@ -1540,7 +1540,7 @@ static int loop_mount(struct bdev *bdev)
ffd = open(bdev->src + 5, O_RDWR); ffd = open(bdev->src + 5, O_RDWR);
if (ffd < 0) { if (ffd < 0) {
SYSERROR("Error opening backing file %s\n", bdev->src); SYSERROR("Error opening backing file %s", bdev->src);
goto out; goto out;
} }
...@@ -1551,13 +1551,13 @@ static int loop_mount(struct bdev *bdev) ...@@ -1551,13 +1551,13 @@ static int loop_mount(struct bdev *bdev)
memset(&lo, 0, sizeof(lo)); memset(&lo, 0, sizeof(lo));
lo.lo_flags = LO_FLAGS_AUTOCLEAR; lo.lo_flags = LO_FLAGS_AUTOCLEAR;
if (ioctl(lfd, LOOP_SET_STATUS64, &lo) < 0) { if (ioctl(lfd, LOOP_SET_STATUS64, &lo) < 0) {
SYSERROR("Error setting autoclear on loop dev\n"); SYSERROR("Error setting autoclear on loop dev");
goto out; goto out;
} }
ret = mount_unknown_fs(loname, bdev->dest, bdev->mntopts); ret = mount_unknown_fs(loname, bdev->dest, bdev->mntopts);
if (ret < 0) if (ret < 0)
ERROR("Error mounting %s\n", bdev->src); ERROR("Error mounting %s", bdev->src);
else else
bdev->lofd = lfd; bdev->lofd = lfd;
...@@ -1724,7 +1724,7 @@ static int loop_create(struct bdev *bdev, const char *dest, const char *n, ...@@ -1724,7 +1724,7 @@ static int loop_create(struct bdev *bdev, const char *dest, const char *n,
return -1; return -1;
if (mkdir_p(bdev->dest, 0755) < 0) { if (mkdir_p(bdev->dest, 0755) < 0) {
ERROR("Error creating %s\n", bdev->dest); ERROR("Error creating %s", bdev->dest);
return -1; return -1;
} }
...@@ -1964,7 +1964,7 @@ static int overlayfs_create(struct bdev *bdev, const char *dest, const char *n, ...@@ -1964,7 +1964,7 @@ static int overlayfs_create(struct bdev *bdev, const char *dest, const char *n,
strcpy(delta+len-6, "delta0"); strcpy(delta+len-6, "delta0");
if (mkdir_p(delta, 0755) < 0) { if (mkdir_p(delta, 0755) < 0) {
ERROR("Error creating %s\n", delta); ERROR("Error creating %s", delta);
return -1; return -1;
} }
...@@ -1980,7 +1980,7 @@ static int overlayfs_create(struct bdev *bdev, const char *dest, const char *n, ...@@ -1980,7 +1980,7 @@ static int overlayfs_create(struct bdev *bdev, const char *dest, const char *n,
return -1; return -1;
if (mkdir_p(bdev->dest, 0755) < 0) { if (mkdir_p(bdev->dest, 0755) < 0) {
ERROR("Error creating %s\n", bdev->dest); ERROR("Error creating %s", bdev->dest);
return -1; return -1;
} }
...@@ -2086,11 +2086,11 @@ static int rsync_rootfs(struct rsync_data *data) ...@@ -2086,11 +2086,11 @@ static int rsync_rootfs(struct rsync_data *data)
// If not a snapshot, copy the fs. // If not a snapshot, copy the fs.
if (orig->ops->mount(orig) < 0) { if (orig->ops->mount(orig) < 0) {
ERROR("failed mounting %s onto %s\n", orig->src, orig->dest); ERROR("failed mounting %s onto %s", orig->src, orig->dest);
return -1; return -1;
} }
if (new->ops->mount(new) < 0) { if (new->ops->mount(new) < 0) {
ERROR("failed mounting %s onto %s\n", new->src, new->dest); ERROR("failed mounting %s onto %s", new->src, new->dest);
return -1; return -1;
} }
if (setgid(0) < 0) { if (setgid(0) < 0) {
...@@ -2104,7 +2104,7 @@ static int rsync_rootfs(struct rsync_data *data) ...@@ -2104,7 +2104,7 @@ static int rsync_rootfs(struct rsync_data *data)
return -1; return -1;
} }
if (do_rsync(orig->dest, new->dest) < 0) { if (do_rsync(orig->dest, new->dest) < 0) {
ERROR("rsyncing %s to %s\n", orig->src, new->src); ERROR("rsyncing %s to %s", orig->src, new->src);
return -1; return -1;
} }
...@@ -2147,7 +2147,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, ...@@ -2147,7 +2147,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
orig = bdev_init(src, NULL, NULL); orig = bdev_init(src, NULL, NULL);
if (!orig) { if (!orig) {
ERROR("failed to detect blockdev type for %s\n", src); ERROR("failed to detect blockdev type for %s", src);
return NULL; return NULL;
} }
...@@ -2214,7 +2214,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, ...@@ -2214,7 +2214,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
} }
if (new->ops->clone_paths(orig, new, oldname, cname, oldpath, lxcpath, snap, newsize) < 0) { if (new->ops->clone_paths(orig, new, oldname, cname, oldpath, lxcpath, snap, newsize) < 0) {
ERROR("failed getting pathnames for cloned storage: %s\n", src); ERROR("failed getting pathnames for cloned storage: %s", src);
bdev_put(orig); bdev_put(orig);
bdev_put(new); bdev_put(new);
return NULL; return NULL;
......
...@@ -117,7 +117,7 @@ int lxc_caps_up(void) ...@@ -117,7 +117,7 @@ int lxc_caps_up(void)
ret = cap_get_flag(caps, cap, CAP_PERMITTED, &flag); ret = cap_get_flag(caps, cap, CAP_PERMITTED, &flag);
if (ret) { if (ret) {
if (errno == EINVAL) { if (errno == EINVAL) {
INFO("Last supported cap was %d\n", cap-1); INFO("Last supported cap was %d", cap-1);
break; break;
} else { } else {
ERROR("failed to cap_get_flag: %m"); ERROR("failed to cap_get_flag: %m");
......
...@@ -1866,7 +1866,7 @@ static int do_setup_cgroup_limits(struct cgfs_data *d, ...@@ -1866,7 +1866,7 @@ static int do_setup_cgroup_limits(struct cgfs_data *d,
cgroup_devices_has_allow_or_deny(d, cg->value, true)) cgroup_devices_has_allow_or_deny(d, cg->value, true))
continue; continue;
if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) { if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) {
ERROR("Error setting %s to %s for %s\n", ERROR("Error setting %s to %s for %s",
cg->subsystem, cg->value, d->name); cg->subsystem, cg->value, d->name);
goto out; goto out;
} }
......
...@@ -746,7 +746,7 @@ static bool cgm_setup_limits(void *hdata, struct lxc_list *cgroup_settings, bool ...@@ -746,7 +746,7 @@ static bool cgm_setup_limits(void *hdata, struct lxc_list *cgroup_settings, bool
*p = '\0'; *p = '\0';
if (cgm_do_set(controller, cg->subsystem, d->cgroup_path if (cgm_do_set(controller, cg->subsystem, d->cgroup_path
, cg->value) < 0) { , cg->value) < 0) {
ERROR("Error setting %s to %s for %s\n", ERROR("Error setting %s to %s for %s",
cg->subsystem, cg->value, d->name); cg->subsystem, cg->value, d->name);
goto out; goto out;
} }
......
...@@ -841,14 +841,14 @@ static int setup_tty(const struct lxc_rootfs *rootfs, ...@@ -841,14 +841,14 @@ static int setup_tty(const struct lxc_rootfs *rootfs,
} }
ret = creat(lxcpath, 0660); ret = creat(lxcpath, 0660);
if (ret==-1 && errno != EEXIST) { if (ret==-1 && errno != EEXIST) {
SYSERROR("error creating %s\n", lxcpath); SYSERROR("error creating %s", lxcpath);
return -1; return -1;
} }
if (ret >= 0) if (ret >= 0)
close(ret); close(ret);
ret = unlink(path); ret = unlink(path);
if (ret && errno != ENOENT) { if (ret && errno != ENOENT) {
SYSERROR("error unlinking %s\n", path); SYSERROR("error unlinking %s", path);
return -1; return -1;
} }
...@@ -865,7 +865,7 @@ static int setup_tty(const struct lxc_rootfs *rootfs, ...@@ -865,7 +865,7 @@ static int setup_tty(const struct lxc_rootfs *rootfs,
} }
ret = symlink(lxcpath, path); ret = symlink(lxcpath, path);
if (ret) { if (ret) {
SYSERROR("failed to create symlink for tty %d\n", i+1); SYSERROR("failed to create symlink for tty %d", i+1);
return -1; return -1;
} }
} else { } else {
...@@ -873,7 +873,7 @@ static int setup_tty(const struct lxc_rootfs *rootfs, ...@@ -873,7 +873,7 @@ static int setup_tty(const struct lxc_rootfs *rootfs,
if (access(path, F_OK)) { if (access(path, F_OK)) {
ret = creat(path, 0660); ret = creat(path, 0660);
if (ret==-1) { if (ret==-1) {
SYSERROR("error creating %s\n", path); SYSERROR("error creating %s", path);
/* this isn't fatal, continue */ /* this isn't fatal, continue */
} else { } else {
close(ret); close(ret);
...@@ -1142,7 +1142,7 @@ static int mount_check_fs( const char *dir, char *fstype ) ...@@ -1142,7 +1142,7 @@ static int mount_check_fs( const char *dir, char *fstype )
int found_fs = 0; int found_fs = 0;
char *p2; char *p2;
DEBUG("entering mount_check_fs for %s\n", dir); DEBUG("entering mount_check_fs for %s", dir);
if ( 0 != access(dir, F_OK) || 0 != stat(dir, &s) || 0 == S_ISDIR(s.st_mode) ) { if ( 0 != access(dir, F_OK) || 0 != stat(dir, &s) || 0 == S_ISDIR(s.st_mode) ) {
return 0; return 0;
...@@ -1184,7 +1184,7 @@ static int mount_check_fs( const char *dir, char *fstype ) ...@@ -1184,7 +1184,7 @@ static int mount_check_fs( const char *dir, char *fstype )
fclose(f); fclose(f);
DEBUG("mount_check_fs returning %d last %s\n", found_fs, fstype); DEBUG("mount_check_fs returning %d last %s", found_fs, fstype);
return found_fs; return found_fs;
} }
...@@ -1313,7 +1313,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath) ...@@ -1313,7 +1313,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath)
char host_path[MAXPATHLEN]; char host_path[MAXPATHLEN];
char devtmpfs_path[MAXPATHLEN]; char devtmpfs_path[MAXPATHLEN];
INFO("Mounting /dev under %s\n", root); INFO("Mounting /dev under %s", root);
ret = snprintf(host_path, MAXPATHLEN, "%s/%s/rootfs.dev", lxcpath, name); ret = snprintf(host_path, MAXPATHLEN, "%s/%s/rootfs.dev", lxcpath, name);
if (ret < 0 || ret > MAXPATHLEN) if (ret < 0 || ret > MAXPATHLEN)
...@@ -1337,7 +1337,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath) ...@@ -1337,7 +1337,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath)
ret = symlink(devtmpfs_path, host_path); ret = symlink(devtmpfs_path, host_path);
if ( ret < 0 ) { if ( ret < 0 ) {
SYSERROR("WARNING: Failed to create symlink '%s'->'%s'\n", host_path, devtmpfs_path); SYSERROR("WARNING: Failed to create symlink '%s'->'%s'", host_path, devtmpfs_path);
} }
DEBUG("Bind mounting %s to %s", devtmpfs_path , path ); DEBUG("Bind mounting %s to %s", devtmpfs_path , path );
ret = mount(devtmpfs_path, path, NULL, MS_BIND, 0 ); ret = mount(devtmpfs_path, path, NULL, MS_BIND, 0 );
...@@ -1353,7 +1353,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath) ...@@ -1353,7 +1353,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath)
} }
} }
if (ret) { if (ret) {
SYSERROR("Failed to mount /dev at %s\n", root); SYSERROR("Failed to mount /dev at %s", root);
return -1; return -1;
} }
ret = snprintf(path, MAXPATHLEN, "%s/dev/pts", root); ret = snprintf(path, MAXPATHLEN, "%s/dev/pts", root);
...@@ -1371,7 +1371,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath) ...@@ -1371,7 +1371,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath)
} }
} }
INFO("Mounted /dev under %s\n", root); INFO("Mounted /dev under %s", root);
return 0; return 0;
} }
...@@ -1399,7 +1399,7 @@ static int setup_autodev(const char *root) ...@@ -1399,7 +1399,7 @@ static int setup_autodev(const char *root)
int i; int i;
mode_t cmask; mode_t cmask;
INFO("Creating initial consoles under %s/dev\n", root); INFO("Creating initial consoles under %s/dev", root);
ret = snprintf(path, MAXPATHLEN, "%s/dev", root); ret = snprintf(path, MAXPATHLEN, "%s/dev", root);
if (ret < 0 || ret >= MAXPATHLEN) { if (ret < 0 || ret >= MAXPATHLEN) {
...@@ -1407,7 +1407,7 @@ static int setup_autodev(const char *root) ...@@ -1407,7 +1407,7 @@ static int setup_autodev(const char *root)
return -1; return -1;
} }
INFO("Populating /dev under %s\n", root); INFO("Populating /dev under %s", root);
cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH); cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH);
for (i = 0; i < sizeof(lxc_devs) / sizeof(lxc_devs[0]); i++) { for (i = 0; i < sizeof(lxc_devs) / sizeof(lxc_devs[0]); i++) {
const struct lxc_devs *d = &lxc_devs[i]; const struct lxc_devs *d = &lxc_devs[i];
...@@ -1416,13 +1416,13 @@ static int setup_autodev(const char *root) ...@@ -1416,13 +1416,13 @@ static int setup_autodev(const char *root)
return -1; return -1;
ret = mknod(path, d->mode, makedev(d->maj, d->min)); ret = mknod(path, d->mode, makedev(d->maj, d->min));
if (ret && errno != EEXIST) { if (ret && errno != EEXIST) {
SYSERROR("Error creating %s\n", d->name); SYSERROR("Error creating %s", d->name);
return -1; return -1;
} }
} }
umask(cmask); umask(cmask);
INFO("Populated /dev under %s\n", root); INFO("Populated /dev under %s", root);
return 0; return 0;
} }
...@@ -1524,7 +1524,7 @@ static int chroot_into_slave(struct lxc_conf *conf) ...@@ -1524,7 +1524,7 @@ static int chroot_into_slave(struct lxc_conf *conf)
SYSERROR("Failed to chroot into tmp-/"); SYSERROR("Failed to chroot into tmp-/");
return -1; return -1;
} }
INFO("Chrooted into tmp-/ at %s\n", path); INFO("Chrooted into tmp-/ at %s", path);
return 0; return 0;
} }
...@@ -1651,7 +1651,7 @@ static int setup_dev_console(const struct lxc_rootfs *rootfs, ...@@ -1651,7 +1651,7 @@ static int setup_dev_console(const struct lxc_rootfs *rootfs,
ret = snprintf(path, sizeof(path), "%s/dev/console", rootfs->mount); ret = snprintf(path, sizeof(path), "%s/dev/console", rootfs->mount);
if (ret >= sizeof(path)) { if (ret >= sizeof(path)) {
ERROR("console path too long\n"); ERROR("console path too long");
return -1; return -1;
} }
...@@ -1699,28 +1699,28 @@ static int setup_ttydir_console(const struct lxc_rootfs *rootfs, ...@@ -1699,28 +1699,28 @@ static int setup_ttydir_console(const struct lxc_rootfs *rootfs,
return -1; return -1;
ret = mkdir(path, 0755); ret = mkdir(path, 0755);
if (ret && errno != EEXIST) { if (ret && errno != EEXIST) {
SYSERROR("failed with errno %d to create %s\n", errno, path); SYSERROR("failed with errno %d to create %s", errno, path);
return -1; return -1;
} }
INFO("created %s\n", path); INFO("created %s", path);
ret = snprintf(lxcpath, sizeof(lxcpath), "%s/dev/%s/console", ret = snprintf(lxcpath, sizeof(lxcpath), "%s/dev/%s/console",
rootfs->mount, ttydir); rootfs->mount, ttydir);
if (ret >= sizeof(lxcpath)) { if (ret >= sizeof(lxcpath)) {
ERROR("console path too long\n"); ERROR("console path too long");
return -1; return -1;
} }
snprintf(path, sizeof(path), "%s/dev/console", rootfs->mount); snprintf(path, sizeof(path), "%s/dev/console", rootfs->mount);
ret = unlink(path); ret = unlink(path);
if (ret && errno != ENOENT) { if (ret && errno != ENOENT) {
SYSERROR("error unlinking %s\n", path); SYSERROR("error unlinking %s", path);
return -1; return -1;
} }
ret = creat(lxcpath, 0660); ret = creat(lxcpath, 0660);
if (ret==-1 && errno != EEXIST) { if (ret==-1 && errno != EEXIST) {
SYSERROR("error %d creating %s\n", errno, lxcpath); SYSERROR("error %d creating %s", errno, lxcpath);
return -1; return -1;
} }
if (ret >= 0) if (ret >= 0)
...@@ -1780,7 +1780,7 @@ static int setup_kmsg(const struct lxc_rootfs *rootfs, ...@@ -1780,7 +1780,7 @@ static int setup_kmsg(const struct lxc_rootfs *rootfs,
ret = unlink(kpath); ret = unlink(kpath);
if (ret && errno != ENOENT) { if (ret && errno != ENOENT) {
SYSERROR("error unlinking %s\n", kpath); SYSERROR("error unlinking %s", kpath);
return -1; return -1;
} }
...@@ -2212,7 +2212,7 @@ static int dropcaps_except(struct lxc_list *caps) ...@@ -2212,7 +2212,7 @@ static int dropcaps_except(struct lxc_list *caps)
char *ptr; char *ptr;
int i, capid; int i, capid;
int numcaps = lxc_caps_last_cap() + 1; int numcaps = lxc_caps_last_cap() + 1;
INFO("found %d capabilities\n", numcaps); INFO("found %d capabilities", numcaps);
if (numcaps <= 0 || numcaps > 200) if (numcaps <= 0 || numcaps > 200)
return -1; return -1;
...@@ -2557,7 +2557,7 @@ void lxc_rename_phys_nics_on_shutdown(struct lxc_conf *conf) ...@@ -2557,7 +2557,7 @@ void lxc_rename_phys_nics_on_shutdown(struct lxc_conf *conf)
INFO("running to reset %d nic names", conf->num_savednics); INFO("running to reset %d nic names", conf->num_savednics);
for (i=0; i<conf->num_savednics; i++) { for (i=0; i<conf->num_savednics; i++) {
struct saved_nic *s = &conf->saved_nics[i]; struct saved_nic *s = &conf->saved_nics[i];
INFO("resetting nic %d to %s\n", s->ifindex, s->orig_name); INFO("resetting nic %d to %s", s->ifindex, s->orig_name);
lxc_netdev_rename_by_index(s->ifindex, s->orig_name); lxc_netdev_rename_by_index(s->ifindex, s->orig_name);
free(s->orig_name); free(s->orig_name);
} }
...@@ -3451,7 +3451,7 @@ static int check_autodev( const char *rootfs, void *data ) ...@@ -3451,7 +3451,7 @@ static int check_autodev( const char *rootfs, void *data )
if( arg && arg->argv[0] ) { if( arg && arg->argv[0] ) {
command = arg->argv[0]; command = arg->argv[0];
DEBUG("Set exec command to %s\n", command ); DEBUG("Set exec command to %s", command );
} }
strncpy( path, command, MAXPATHLEN-1 ); strncpy( path, command, MAXPATHLEN-1 );
...@@ -3619,7 +3619,7 @@ int lxc_setup(struct lxc_handler *handler) ...@@ -3619,7 +3619,7 @@ int lxc_setup(struct lxc_handler *handler)
return -1; return -1;
} }
if (dropcaps_except(&lxc_conf->keepcaps)) { if (dropcaps_except(&lxc_conf->keepcaps)) {
ERROR("failed to keep requested caps\n"); ERROR("failed to keep requested caps");
return -1; return -1;
} }
} else if (setup_caps(&lxc_conf->caps)) { } else if (setup_caps(&lxc_conf->caps)) {
......
...@@ -76,7 +76,7 @@ static char *apparmor_process_label_get(pid_t pid) ...@@ -76,7 +76,7 @@ static char *apparmor_process_label_get(pid_t pid)
again: again:
f = fopen(path, "r"); f = fopen(path, "r");
if (!f) { if (!f) {
SYSERROR("opening %s\n", path); SYSERROR("opening %s", path);
if (buf) if (buf)
free(buf); free(buf);
return NULL; return NULL;
...@@ -94,7 +94,7 @@ again: ...@@ -94,7 +94,7 @@ again:
ret = fread(buf, 1, sz - 1, f); ret = fread(buf, 1, sz - 1, f);
fclose(f); fclose(f);
if (ret < 0) { if (ret < 0) {
ERROR("reading %s\n", path); ERROR("reading %s", path);
free(buf); free(buf);
return NULL; return NULL;
} }
......
...@@ -56,7 +56,7 @@ static int do_snapshot(struct lxc_container *c) ...@@ -56,7 +56,7 @@ static int do_snapshot(struct lxc_container *c)
return -1; return -1;
} }
INFO("Created snapshot snap%d\n", ret); INFO("Created snapshot snap%d", ret);
return 0; return 0;
} }
......
...@@ -743,7 +743,7 @@ static bool create_container_dir(struct lxc_container *c) ...@@ -743,7 +743,7 @@ static bool create_container_dir(struct lxc_container *c)
if (errno == EEXIST) if (errno == EEXIST)
ret = 0; ret = 0;
else else
SYSERROR("failed to create container path for %s\n", c->name); SYSERROR("failed to create container path for %s", c->name);
} }
free(s); free(s);
return ret == 0; return ret == 0;
...@@ -781,7 +781,7 @@ static struct bdev *do_bdev_create(struct lxc_container *c, const char *type, ...@@ -781,7 +781,7 @@ static struct bdev *do_bdev_create(struct lxc_container *c, const char *type,
bdev = bdev_create(dest, type, c->name, specs); bdev = bdev_create(dest, type, c->name, specs);
if (!bdev) { if (!bdev) {
ERROR("Failed to create backing store type %s\n", type); ERROR("Failed to create backing store type %s", type);
return NULL; return NULL;
} }
...@@ -792,7 +792,7 @@ static struct bdev *do_bdev_create(struct lxc_container *c, const char *type, ...@@ -792,7 +792,7 @@ static struct bdev *do_bdev_create(struct lxc_container *c, const char *type,
if (geteuid() != 0) { if (geteuid() != 0) {
if (chown_mapped_root(bdev->dest, c->lxc_conf) < 0) { if (chown_mapped_root(bdev->dest, c->lxc_conf) < 0) {
ERROR("Error chowning %s to container root\n", bdev->dest); ERROR("Error chowning %s to container root", bdev->dest);
bdev_put(bdev); bdev_put(bdev);
return NULL; return NULL;
} }
...@@ -827,7 +827,7 @@ static char *get_template_path(const char *t) ...@@ -827,7 +827,7 @@ static char *get_template_path(const char *t)
return NULL; return NULL;
} }
if (access(tpath, X_OK) < 0) { if (access(tpath, X_OK) < 0) {
SYSERROR("bad template: %s\n", t); SYSERROR("bad template: %s", t);
free(tpath); free(tpath);
return NULL; return NULL;
} }
...@@ -853,7 +853,7 @@ static bool create_run_template(struct lxc_container *c, char *tpath, bool quiet ...@@ -853,7 +853,7 @@ static bool create_run_template(struct lxc_container *c, char *tpath, bool quiet
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
SYSERROR("failed to fork task for container creation template\n"); SYSERROR("failed to fork task for container creation template");
return false; return false;
} }
...@@ -1083,7 +1083,7 @@ static bool create_run_template(struct lxc_container *c, char *tpath, bool quiet ...@@ -1083,7 +1083,7 @@ static bool create_run_template(struct lxc_container *c, char *tpath, bool quiet
} }
if (wait_for_pid(pid) != 0) { if (wait_for_pid(pid) != 0) {
ERROR("container creation template for %s failed\n", c->name); ERROR("container creation template for %s failed", c->name);
return false; return false;
} }
...@@ -1126,7 +1126,7 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[]) ...@@ -1126,7 +1126,7 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[])
#if HAVE_LIBGNUTLS #if HAVE_LIBGNUTLS
tpath = get_template_path(t); tpath = get_template_path(t);
if (!tpath) { if (!tpath) {
ERROR("bad template: %s\n", t); ERROR("bad template: %s", t);
goto out_free_contents; goto out_free_contents;
} }
...@@ -1222,7 +1222,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, ...@@ -1222,7 +1222,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t,
if (t) { if (t) {
tpath = get_template_path(t); tpath = get_template_path(t);
if (!tpath) { if (!tpath) {
ERROR("bad template: %s\n", t); ERROR("bad template: %s", t);
goto out; goto out;
} }
} }
...@@ -1241,7 +1241,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, ...@@ -1241,7 +1241,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t,
if (!c->lxc_conf) { if (!c->lxc_conf) {
if (!c->load_config(c, lxc_global_config_value("lxc.default_config"))) { if (!c->load_config(c, lxc_global_config_value("lxc.default_config"))) {
ERROR("Error loading default configuration file %s\n", lxc_global_config_value("lxc.default_config")); ERROR("Error loading default configuration file %s", lxc_global_config_value("lxc.default_config"));
goto free_tpath; goto free_tpath;
} }
} }
...@@ -1282,7 +1282,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, ...@@ -1282,7 +1282,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t,
*/ */
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
SYSERROR("failed to fork task for container creation template\n"); SYSERROR("failed to fork task for container creation template");
goto out_unlock; goto out_unlock;
} }
...@@ -1297,7 +1297,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, ...@@ -1297,7 +1297,7 @@ static bool lxcapi_create(struct lxc_container *c, const char *t,
/* save config file again to store the new rootfs location */ /* save config file again to store the new rootfs location */
if (!c->save_config(c, NULL)) { if (!c->save_config(c, NULL)) {
ERROR("failed to save starting configuration for %s\n", c->name); ERROR("failed to save starting configuration for %s", c->name);
// parent task won't see bdev in config so we delete it // parent task won't see bdev in config so we delete it
bdev->ops->umount(bdev); bdev->ops->umount(bdev);
bdev->ops->destroy(bdev); bdev->ops->destroy(bdev);
...@@ -1558,7 +1558,7 @@ static char** lxcapi_get_interfaces(struct lxc_container *c) ...@@ -1558,7 +1558,7 @@ static char** lxcapi_get_interfaces(struct lxc_container *c)
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
SYSERROR("failed to fork task to get interfaces information\n"); SYSERROR("failed to fork task to get interfaces information");
close(pipefd[0]); close(pipefd[0]);
close(pipefd[1]); close(pipefd[1]);
return NULL; return NULL;
...@@ -1645,7 +1645,7 @@ static char** lxcapi_get_ips(struct lxc_container *c, const char* interface, con ...@@ -1645,7 +1645,7 @@ static char** lxcapi_get_ips(struct lxc_container *c, const char* interface, con
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
SYSERROR("failed to fork task to get container ips\n"); SYSERROR("failed to fork task to get container ips");
close(pipefd[0]); close(pipefd[0]);
close(pipefd[1]); close(pipefd[1]);
return NULL; return NULL;
...@@ -1808,7 +1808,7 @@ static bool lxcapi_save_config(struct lxc_container *c, const char *alt_file) ...@@ -1808,7 +1808,7 @@ static bool lxcapi_save_config(struct lxc_container *c, const char *alt_file)
// If we haven't yet loaded a config, load the stock config // If we haven't yet loaded a config, load the stock config
if (!c->lxc_conf) { if (!c->lxc_conf) {
if (!c->load_config(c, lxc_global_config_value("lxc.default_config"))) { if (!c->load_config(c, lxc_global_config_value("lxc.default_config"))) {
ERROR("Error loading default configuration file %s while saving %s\n", lxc_global_config_value("lxc.default_config"), c->name); ERROR("Error loading default configuration file %s while saving %s", lxc_global_config_value("lxc.default_config"), c->name);
return false; return false;
} }
} }
...@@ -1919,7 +1919,7 @@ static void mod_all_rdeps(struct lxc_container *c, bool inc) ...@@ -1919,7 +1919,7 @@ static void mod_all_rdeps(struct lxc_container *c, bool inc)
return; return;
while (getline(&lxcpath, &pathlen, f) != -1) { while (getline(&lxcpath, &pathlen, f) != -1) {
if (getline(&lxcname, &namelen, f) == -1) { if (getline(&lxcname, &namelen, f) == -1) {
ERROR("badly formatted file %s\n", path); ERROR("badly formatted file %s", path);
goto out; goto out;
} }
strip_newline(lxcpath); strip_newline(lxcpath);
...@@ -2522,7 +2522,7 @@ static int clone_update_rootfs(struct clone_update_data *data) ...@@ -2522,7 +2522,7 @@ static int clone_update_rootfs(struct clone_update_data *data)
if (!file_exists(path)) if (!file_exists(path))
return 0; return 0;
if (!(fout = fopen(path, "w"))) { if (!(fout = fopen(path, "w"))) {
SYSERROR("unable to open %s: ignoring\n", path); SYSERROR("unable to open %s: ignoring", path);
return 0; return 0;
} }
if (fprintf(fout, "%s", c->name) < 0) { if (fprintf(fout, "%s", c->name) < 0) {
...@@ -2563,7 +2563,7 @@ static int create_file_dirname(char *path) ...@@ -2563,7 +2563,7 @@ static int create_file_dirname(char *path)
*p = '\0'; *p = '\0';
ret = mkdir(path, 0755); ret = mkdir(path, 0755);
if (ret && errno != EEXIST) if (ret && errno != EEXIST)
SYSERROR("creating container path %s\n", path); SYSERROR("creating container path %s", path);
*p = '/'; *p = '/';
return ret; return ret;
} }
...@@ -2628,7 +2628,7 @@ static struct lxc_container *lxcapi_clone(struct lxc_container *c, const char *n ...@@ -2628,7 +2628,7 @@ static struct lxc_container *lxcapi_clone(struct lxc_container *c, const char *n
if (am_unpriv()) { if (am_unpriv()) {
if (chown_mapped_root(newpath, c->lxc_conf) < 0) { if (chown_mapped_root(newpath, c->lxc_conf) < 0) {
ERROR("Error chowning %s to container root\n", newpath); ERROR("Error chowning %s to container root", newpath);
goto out; goto out;
} }
} }
...@@ -2814,7 +2814,7 @@ static int lxcapi_snapshot(struct lxc_container *c, const char *commentfile) ...@@ -2814,7 +2814,7 @@ static int lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
LXC_CLONE_KEEPBDEVTYPE | LXC_CLONE_MAYBE_SNAPSHOT; LXC_CLONE_KEEPBDEVTYPE | LXC_CLONE_MAYBE_SNAPSHOT;
c2 = c->clone(c, newname, snappath, flags, NULL, NULL, 0, NULL); c2 = c->clone(c, newname, snappath, flags, NULL, NULL, 0, NULL);
if (!c2) { if (!c2) {
ERROR("clone of %s:%s failed\n", c->config_path, c->name); ERROR("clone of %s:%s failed", c->config_path, c->name);
return -1; return -1;
} }
...@@ -2835,7 +2835,7 @@ static int lxcapi_snapshot(struct lxc_container *c, const char *commentfile) ...@@ -2835,7 +2835,7 @@ static int lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
sprintf(dfnam, "%s/%s/ts", snappath, newname); sprintf(dfnam, "%s/%s/ts", snappath, newname);
f = fopen(dfnam, "w"); f = fopen(dfnam, "w");
if (!f) { if (!f) {
ERROR("Failed to open %s\n", dfnam); ERROR("Failed to open %s", dfnam);
return -1; return -1;
} }
if (fprintf(f, "%s", buffer) < 0) { if (fprintf(f, "%s", buffer) < 0) {
......
...@@ -76,7 +76,7 @@ static int parse_config(FILE *f, struct lxc_conf *conf) ...@@ -76,7 +76,7 @@ static int parse_config(FILE *f, struct lxc_conf *conf)
#endif #endif
SCMP_ACT_ALLOW, nr, 0); SCMP_ACT_ALLOW, nr, 0);
if (ret < 0) { if (ret < 0) {
ERROR("failed loading allow rule for %d\n", nr); ERROR("failed loading allow rule for %d", nr);
return ret; return ret;
} }
} }
...@@ -110,13 +110,13 @@ int lxc_read_seccomp_config(struct lxc_conf *conf) ...@@ -110,13 +110,13 @@ int lxc_read_seccomp_config(struct lxc_conf *conf)
conf->seccomp_ctx, conf->seccomp_ctx,
#endif #endif
SCMP_FLTATR_CTL_NNP, 0)) { SCMP_FLTATR_CTL_NNP, 0)) {
ERROR("failed to turn off n-new-privs\n"); ERROR("failed to turn off n-new-privs");
return -1; return -1;
} }
f = fopen(conf->seccomp, "r"); f = fopen(conf->seccomp, "r");
if (!f) { if (!f) {
SYSERROR("failed to open seccomp policy file %s\n", conf->seccomp); SYSERROR("failed to open seccomp policy file %s", conf->seccomp);
return -1; return -1;
} }
ret = parse_config(f, conf); ret = parse_config(f, conf);
......
...@@ -317,7 +317,7 @@ static int lxc_poll(const char *name, struct lxc_handler *handler) ...@@ -317,7 +317,7 @@ static int lxc_poll(const char *name, struct lxc_handler *handler)
goto out_mainloop_open; goto out_mainloop_open;
} }
#else #else
DEBUG("not starting utmp handler as cap_sys_boot cannot be dropped without capabilities support\n"); DEBUG("not starting utmp handler as cap_sys_boot cannot be dropped without capabilities support");
#endif #endif
} }
...@@ -518,19 +518,19 @@ static int must_drop_cap_sys_boot(struct lxc_conf *conf) ...@@ -518,19 +518,19 @@ static int must_drop_cap_sys_boot(struct lxc_conf *conf)
flags |= CLONE_NEWUSER; flags |= CLONE_NEWUSER;
#ifdef __ia64__ #ifdef __ia64__
pid = __clone2(container_reboot_supported, stack, stack_size, flags, &cmd); pid = __clone2(container_reboot_supported, stack, stack_size, flags, &cmd);
#else #else
stack += stack_size; stack += stack_size;
pid = clone(container_reboot_supported, stack, flags, &cmd); pid = clone(container_reboot_supported, stack, flags, &cmd);
#endif #endif
if (pid < 0) { if (pid < 0) {
SYSERROR("failed to clone\n"); SYSERROR("failed to clone");
return -1; return -1;
} }
if (wait(&status) < 0) { if (wait(&status) < 0) {
SYSERROR("unexpected wait error: %m\n"); SYSERROR("unexpected wait error: %m");
return -1; return -1;
} }
if (WEXITSTATUS(status) != 1) if (WEXITSTATUS(status) != 1)
return 1; return 1;
...@@ -598,7 +598,7 @@ static int do_start(void *data) ...@@ -598,7 +598,7 @@ static int do_start(void *data)
SYSERROR("failed to remove CAP_SYS_BOOT capability"); SYSERROR("failed to remove CAP_SYS_BOOT capability");
goto out_warn_father; goto out_warn_father;
} }
DEBUG("Dropped cap_sys_boot\n"); DEBUG("Dropped cap_sys_boot");
} }
#endif #endif
...@@ -678,7 +678,7 @@ static int save_phys_nics(struct lxc_conf *conf) ...@@ -678,7 +678,7 @@ static int save_phys_nics(struct lxc_conf *conf)
SYSERROR("failed to allocate memory"); SYSERROR("failed to allocate memory");
return -1; return -1;
} }
INFO("stored saved_nic #%d idx %d name %s\n", conf->num_savednics, INFO("stored saved_nic #%d idx %d name %s", conf->num_savednics,
conf->saved_nics[conf->num_savednics].ifindex, conf->saved_nics[conf->num_savednics].ifindex,
conf->saved_nics[conf->num_savednics].orig_name); conf->saved_nics[conf->num_savednics].orig_name);
conf->num_savednics++; conf->num_savednics++;
...@@ -900,12 +900,12 @@ int __lxc_start(const char *name, struct lxc_conf *conf, ...@@ -900,12 +900,12 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
if (must_drop_cap_sys_boot(handler->conf)) { if (must_drop_cap_sys_boot(handler->conf)) {
#if HAVE_SYS_CAPABILITY_H #if HAVE_SYS_CAPABILITY_H
DEBUG("Dropping cap_sys_boot\n"); DEBUG("Dropping cap_sys_boot");
#else #else
DEBUG("Can't drop cap_sys_boot as capabilities aren't supported\n"); DEBUG("Can't drop cap_sys_boot as capabilities aren't supported");
#endif #endif
} else { } else {
DEBUG("Not dropping cap_sys_boot or watching utmp\n"); DEBUG("Not dropping cap_sys_boot or watching utmp");
handler->conf->need_utmp_watch = 0; handler->conf->need_utmp_watch = 0;
} }
...@@ -940,7 +940,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf, ...@@ -940,7 +940,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
handler->conf->reboot = 1; handler->conf->reboot = 1;
break; break;
default: default:
DEBUG("unknown exit status for init: %d\n", WTERMSIG(status)); DEBUG("unknown exit status for init: %d", WTERMSIG(status));
break; break;
} }
} }
......
...@@ -192,7 +192,7 @@ extern int mkdir_p(const char *dir, mode_t mode) ...@@ -192,7 +192,7 @@ extern int mkdir_p(const char *dir, mode_t mode)
makeme = strndup(orig, dir - orig); makeme = strndup(orig, dir - orig);
if (*makeme) { if (*makeme) {
if (mkdir(makeme, mode) && errno != EEXIST) { if (mkdir(makeme, mode) && errno != EEXIST) {
SYSERROR("failed to create directory '%s'\n", makeme); SYSERROR("failed to create directory '%s'", makeme);
free(makeme); free(makeme);
return -1; return -1;
} }
......
...@@ -68,7 +68,7 @@ static void test_list_func(const char *lxcpath, const char *type, ...@@ -68,7 +68,7 @@ static void test_list_func(const char *lxcpath, const char *type,
struct lxc_container *c = clist[i]; struct lxc_container *c = clist[i];
printf("%-10s Got container struct %s, name %s\n", type, c->name, names[i]); printf("%-10s Got container struct %s, name %s\n", type, c->name, names[i]);
if (strcmp(c->name, names[i])) if (strcmp(c->name, names[i]))
fprintf(stderr, "ERROR: name mismatch!\n"); fprintf(stderr, "ERROR: name mismatch!");
free(names[i]); free(names[i]);
lxc_container_put(c); lxc_container_put(c);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment