Commit fc4e022b authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

criu/*: annual pr_perror() usage sanitization

When using pr_perror(), we should not end the message with \n,
as it is added automatically.

Unfortunately, I still can't figure a way to check this at compile
time, so here's the annual patch.

travis-ci: success for Assorted nitpicks
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 106e2d29
...@@ -371,18 +371,18 @@ static int cgp_parse_file(char *path) ...@@ -371,18 +371,18 @@ static int cgp_parse_file(char *path)
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd < 0) { if (fd < 0) {
pr_perror("Can't open file %s\n", path); pr_perror("Can't open file %s", path);
goto err; goto err;
} }
if (fstat(fd, &st)) { if (fstat(fd, &st)) {
pr_perror("Can't stat file %s\n", path); pr_perror("Can't stat file %s", path);
goto err; goto err;
} }
mem = mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0); mem = mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0);
if (mem == MAP_FAILED) { if (mem == MAP_FAILED) {
pr_perror("Can't mmap file %s\n", path); pr_perror("Can't mmap file %s", path);
goto err; goto err;
} }
......
...@@ -579,7 +579,7 @@ off_t img_raw_size(struct cr_img *img) ...@@ -579,7 +579,7 @@ off_t img_raw_size(struct cr_img *img)
struct stat stat; struct stat stat;
if (fstat(img->_x.fd, &stat)) { if (fstat(img->_x.fd, &stat)) {
pr_perror("Failed to get image stats\n"); pr_perror("Failed to get image stats");
return -1; return -1;
} }
......
...@@ -1204,7 +1204,7 @@ static __maybe_unused int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_ ...@@ -1204,7 +1204,7 @@ static __maybe_unused int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_
goto restore_ns; goto restore_ns;
} else { } else {
if (stat(target, &st) < 0) { if (stat(target, &st) < 0) {
pr_perror("Can't stat on %s\n", target); pr_perror("Can't stat %s", target);
exit_code = 0; exit_code = 0;
} else { } else {
*s_dev = MKKDEV(major(st.st_dev), minor(st.st_dev)); *s_dev = MKKDEV(major(st.st_dev), minor(st.st_dev));
...@@ -1740,7 +1740,7 @@ static int do_new_mount(struct mount_info *mi) ...@@ -1740,7 +1740,7 @@ static int do_new_mount(struct mount_info *mi)
if (mi->mnt_id == CRTIME_MNT_ID) { if (mi->mnt_id == CRTIME_MNT_ID) {
/* C-r time mountpoint, umount it */ /* C-r time mountpoint, umount it */
if (umount(mi->mountpoint) < 0) { if (umount(mi->mountpoint) < 0) {
pr_perror("Can't umount %s\n", mi->mountpoint); pr_perror("Can't umount %s", mi->mountpoint);
return -1; return -1;
} }
goto out; goto out;
...@@ -1751,7 +1751,7 @@ static int do_new_mount(struct mount_info *mi) ...@@ -1751,7 +1751,7 @@ static int do_new_mount(struct mount_info *mi)
fd = open(mi->mountpoint, O_PATH); fd = open(mi->mountpoint, O_PATH);
if (fd < 0) { if (fd < 0) {
pr_perror("Unable to open %s\n", mi->mountpoint); pr_perror("Unable to open %s", mi->mountpoint);
return -1; return -1;
} }
...@@ -3215,7 +3215,7 @@ void clean_cr_time_mounts(void) ...@@ -3215,7 +3215,7 @@ void clean_cr_time_mounts(void)
} }
if (umount(mi->mountpoint) < 0) if (umount(mi->mountpoint) < 0)
pr_perror("Can't umount forced mount %s\n", mi->mountpoint); pr_perror("Can't umount forced mount %s", mi->mountpoint);
if (restore_ns(mnt_fd, &mnt_ns_desc)) { if (restore_ns(mnt_fd, &mnt_ns_desc)) {
pr_err("cleanup_forced_mounts exiting with wrong mnt_ns\n"); pr_err("cleanup_forced_mounts exiting with wrong mnt_ns\n");
......
...@@ -2328,7 +2328,7 @@ int parse_task_cgroup(int pid, struct parasite_dump_cgroup_args *args, struct li ...@@ -2328,7 +2328,7 @@ int parse_task_cgroup(int pid, struct parasite_dump_cgroup_args *args, struct li
f = fmemopen(args->contents, strlen(args->contents), "r"); f = fmemopen(args->contents, strlen(args->contents), "r");
if (!f) { if (!f) {
pr_perror("couldn't fmemopen cgroup buffer:\n%s", args->contents); pr_perror("couldn't fmemopen cgroup buffer %s", args->contents);
return -1; return -1;
} }
......
...@@ -1019,7 +1019,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui) ...@@ -1019,7 +1019,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui)
} }
if (ui->ue->deleted && unlink((char *)ui->ue->name.data) < 0) { if (ui->ue->deleted && unlink((char *)ui->ue->name.data) < 0) {
pr_perror("failed to unlink %s\n", ui->ue->name.data); pr_perror("failed to unlink %s", ui->ue->name.data);
goto done; goto done;
} }
} }
......
...@@ -841,7 +841,7 @@ static int restore_tty_params(int fd, struct tty_info *info) ...@@ -841,7 +841,7 @@ static int restore_tty_params(int fd, struct tty_info *info)
if (info->tie->has_uid && info->tie->has_gid) { if (info->tie->has_uid && info->tie->has_gid) {
if (fchown(fd, info->tie->uid, info->tie->gid)) { if (fchown(fd, info->tie->uid, info->tie->gid)) {
pr_perror("Can't setup uid %d gid %d on %x\n", pr_perror("Can't setup uid %d gid %d on %x",
(int)info->tie->uid, (int)info->tie->uid,
(int)info->tie->gid, (int)info->tie->gid,
info->tfe->id); info->tfe->id);
...@@ -1872,7 +1872,7 @@ static int tty_reblock(int id, int lfd, int flags) ...@@ -1872,7 +1872,7 @@ static int tty_reblock(int id, int lfd, int flags)
if ((flags & fmask) != fmask) { if ((flags & fmask) != fmask) {
if (fcntl(lfd, F_SETFL, flags)) { if (fcntl(lfd, F_SETFL, flags)) {
ret = -errno; ret = -errno;
pr_perror("Can't revert mode back to %o on (%#x)\n", fmask, id); pr_perror("Can't revert mode back to %o on (%#x)", fmask, id);
return ret; return ret;
} }
} }
...@@ -1888,7 +1888,7 @@ static int tty_unblock(int id, int lfd, int flags) ...@@ -1888,7 +1888,7 @@ static int tty_unblock(int id, int lfd, int flags)
if ((flags & fmask) != fmask) { if ((flags & fmask) != fmask) {
if (fcntl(lfd, F_SETFL, fmask)) { if (fcntl(lfd, F_SETFL, fmask)) {
ret = -errno; ret = -errno;
pr_perror("Can't change mode to %o on (%#x)\n", fmask, id); pr_perror("Can't change mode to %o on (%#x)", fmask, id);
return ret; return ret;
} }
} }
...@@ -1972,7 +1972,7 @@ static void __tty_do_writeback_queued_data(struct tty_dump_info *dinfo) ...@@ -1972,7 +1972,7 @@ static void __tty_do_writeback_queued_data(struct tty_dump_info *dinfo)
if (dinfo->tty_data) { if (dinfo->tty_data) {
if (write(dinfo->link->lfd, dinfo->tty_data, if (write(dinfo->link->lfd, dinfo->tty_data,
dinfo->tty_data_size) != dinfo->tty_data_size) dinfo->tty_data_size) != dinfo->tty_data_size)
pr_perror("Can't writeback to tty (%#x)\n", dinfo->id); pr_perror("Can't writeback to tty (%#x)", dinfo->id);
} }
tty_reblock(dinfo->link->id, dinfo->link->lfd, dinfo->link->flags); tty_reblock(dinfo->link->id, dinfo->link->lfd, dinfo->link->flags);
} }
......
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