[CRIU] [PATCH] sources: fix pr_perror usage

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Fri Apr 22 03:52:38 PDT 2016


This is log cleanup patch.
Pr_perror prints new line by itself.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/cgroup.c     |    2 +-
 criu/cr-check.c   |    4 ++--
 criu/cr-restore.c |    2 +-
 criu/fsnotify.c   |    2 +-
 criu/mem.c        |    2 +-
 criu/mount.c      |    8 ++++----
 criu/namespaces.c |    4 ++--
 criu/proc_parse.c |    4 ++--
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index e1d5023..a706ff6 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -1245,7 +1245,7 @@ static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
 
 	len = strlen(cg_prop_entry_p->value);
 	if (write(fd, cg_prop_entry_p->value, len) != len) {
-		pr_perror("Failed writing %s to %s\n", cg_prop_entry_p->value, path);
+		pr_perror("Failed writing %s to %s", cg_prop_entry_p->value, path);
 		goto out;
 	}
 
diff --git a/criu/cr-check.c b/criu/cr-check.c
index e4f34c7..ca506a1 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -879,7 +879,7 @@ static int check_autofs(void)
 
 	dir = mkdtemp(template);
 	if (!dir) {
-		pr_perror("failed to construct temporary name\n");
+		pr_perror("failed to construct temporary name");
 		goto free_options;
 	}
 
@@ -891,7 +891,7 @@ static int check_autofs(void)
 	ret = check_autofs_pipe_ino();
 
 	if (umount(dir))
-		pr_perror("failed to umount %s\n", dir);
+		pr_perror("failed to umount %s", dir);
 
 unlink_dir:
 	if (rmdir(dir))
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 34db7f7..16b2e8f 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1039,7 +1039,7 @@ static int wait_on_helpers_zombies(void)
 		switch (pi->pid.state) {
 		case TASK_DEAD:
 			if (waitid(P_PID, pid, NULL, WNOWAIT | WEXITED) < 0) {
-				pr_perror("Wait on %d zombie failed\n", pid);
+				pr_perror("Wait on %d zombie failed", pid);
 				return -1;
 			}
 			break;
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index 4a9b2dc..4035506 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -163,7 +163,7 @@ static char *alloc_openable(unsigned int s_dev, unsigned long i_ino, FhEntry *f_
 		openable_fd = openat(mntfd, __path, O_PATH);
 		if (openable_fd >= 0) {
 			if (fstat(openable_fd, &st)) {
-				pr_perror("Can't stat on %s\n", __path);
+				pr_perror("Can't stat on %s", __path);
 				close(openable_fd);
 				return ERR_PTR(-errno);
 			}
diff --git a/criu/mem.c b/criu/mem.c
index dc2b552..4d11a8d 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -55,7 +55,7 @@ int do_task_reset_dirty_track(int pid)
                if (errno == EINVAL) /* No clear-soft-dirty in kernel */
                        ret = 1;
                else {
-                       pr_perror("Can't reset %d's dirty memory tracker (%d)\n", pid, errno);
+                       pr_perror("Can't reset %d's dirty memory tracker (%d)", pid, errno);
                        ret = -1;
                }
        } else {
diff --git a/criu/mount.c b/criu/mount.c
index b829ae5..e41c196 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1374,7 +1374,7 @@ static int parse_binfmt_misc_entry(struct bfd *f, BinfmtMiscEntry *bme)
 		DUP_EQUAL_AS("mask ", mask)
 #undef DUP_EQUAL_AS
 
-		pr_perror("binfmt_misc: unsupported feature %s\n", str);
+		pr_perror("binfmt_misc: unsupported feature %s", str);
 		return -1;
 	}
 
@@ -2257,7 +2257,7 @@ static int fetch_rt_stat(struct mount_info *m, const char *where)
 	struct stat st;
 
 	if (stat(where, &st)) {
-		pr_perror("Can't stat on %s\n", where);
+		pr_perror("Can't stat on %s", where);
 		return -1;
 	}
 
@@ -2376,7 +2376,7 @@ static int mount_clean_path()
 static int umount_clean_path()
 {
 	if (umount2(mnt_clean_path, MNT_DETACH)) {
-		pr_perror("Unable to umount %s\n", mnt_clean_path);
+		pr_perror("Unable to umount %s", mnt_clean_path);
 		return -1;
 	}
 
@@ -3270,7 +3270,7 @@ int prepare_mnt_ns(void)
 			if (mount("proc", "/proc", "proc",
 						MS_MGC_VAL | MS_NOSUID | MS_NOEXEC | MS_NODEV,
 						NULL)) {
-				pr_perror("Can't mount proc\n");
+				pr_perror("Can't mount proc");
 				return -1;
 			}
 
diff --git a/criu/namespaces.c b/criu/namespaces.c
index 44275cd..db8f350 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -171,7 +171,7 @@ int join_ns_add(const char *type, char *ns_file, char *extra_opts)
 		jn->nd = &mnt_ns_desc;
 		join_ns_flags |= CLONE_NEWNS;
 	} else {
-		pr_perror("invalid namespace type %s\n", type);
+		pr_err("invalid namespace type %s\n", type);
 		goto err;
 	}
 
@@ -837,7 +837,7 @@ static int check_user_ns(int pid)
 		}
 
 		if (setgroups(0, NULL) < 0) {
-			pr_perror("Unable to drop supplementary groups\n");
+			pr_perror("Unable to drop supplementary groups");
 			return -1;
 		}
 
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index 4522ce6..174b540 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -327,7 +327,7 @@ static int vma_get_mapfile(char *fname, struct vma_area *vma, DIR *mfd,
 			}
 
 			if (fstat(fd, vma->vmst) < 0) {
-				pr_perror("Can't stat [%s]\n", fname);
+				pr_perror("Can't stat [%s]", fname);
 				close(fd);
 				return -1;
 			}
@@ -2238,7 +2238,7 @@ int parse_task_cgroup(int pid, struct parasite_dump_cgroup_args *args, struct li
 
 	f = fmemopen(args->contents, strlen(args->contents), "r");
 	if (!f) {
-		pr_perror("couldn't fmemopen cgroup buffer:\n%s\n", args->contents);
+		pr_perror("couldn't fmemopen cgroup buffer:\n%s", args->contents);
 		return -1;
 	}
 



More information about the CRIU mailing list