[CRIU] [PATCH] Don't use \Newline in pr_perror

Cyrill Gorcunov gorcunov at openvz.org
Tue Apr 30 12:44:12 EDT 2013


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c | 10 +++++-----
 files-reg.c  |  6 +++---
 files.c      |  6 +++---
 page-xfer.c  | 12 ++++++------
 proc_parse.c |  2 +-
 sk-queue.c   | 10 +++++-----
 sk-tcp.c     |  4 ++--
 sockets.c    |  2 +-
 tty.c        |  6 +++---
 util.c       |  6 +++---
 10 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 2a72d4a..b8a936b 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -374,7 +374,7 @@ static int restore_priv_vma_content(pid_t pid)
 			ret = madvise(addr + PAGE_SIZE * i,
 						PAGE_SIZE, MADV_DONTNEED);
 			if (ret < 0) {
-				pr_perror("madvise failed\n");
+				pr_perror("madvise failed");
 				return -1;
 			}
 			i++;
@@ -1190,7 +1190,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
 
 	ret = sigaction(SIGCHLD, NULL, &act);
 	if (ret < 0) {
-		pr_perror("sigaction() failed\n");
+		pr_perror("sigaction() failed");
 		return -1;
 	}
 
@@ -1201,7 +1201,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
 
 	ret = sigaction(SIGCHLD, &act, &old_act);
 	if (ret < 0) {
-		pr_perror("sigaction() failed\n");
+		pr_perror("sigaction() failed");
 		return -1;
 	}
 
@@ -1257,7 +1257,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
 	/* Restore SIGCHLD here to skip SIGCHLD from a network sctip */
 	ret = sigaction(SIGCHLD, &old_act, NULL);
 	if (ret < 0) {
-		pr_perror("sigaction() failed\n");
+		pr_perror("sigaction() failed");
 		goto out;
 	}
 
@@ -1747,7 +1747,7 @@ static int open_signal_image(int type, pid_t pid, siginfo_t **ptr,
 			else
 				*ptr = mremap(*ptr, *size, new_size, MREMAP_MAYMOVE);
 			if (*ptr == MAP_FAILED) {
-				pr_perror("Can't allocate memory for siginfo-s\n");
+				pr_perror("Can't allocate memory for siginfo-s");
 				ret = -1;
 				break;
 			}
diff --git a/files-reg.c b/files-reg.c
index d1d03b8..9faecda 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -92,7 +92,7 @@ static int open_remap_ghost(struct reg_file_info *rfi,
 
 	if (S_ISFIFO(gfe->mode)) {
 		if (mknod(gf->remap.path, gfe->mode, 0)) {
-			pr_perror("Can't create node for ghost file\n");
+			pr_perror("Can't create node for ghost file");
 			goto close_ifd;
 		}
 		ghost_flags = O_RDWR; /* To not block */
@@ -106,7 +106,7 @@ static int open_remap_ghost(struct reg_file_info *rfi,
 	}
 
 	if (fchown(gfd, gfe->uid, gfe->gid) < 0) {
-		pr_perror("Can't reset user/group on ghost %#x\n", rfe->remap_id);
+		pr_perror("Can't reset user/group on ghost %#x", rfe->remap_id);
 		goto close_all;
 	}
 
@@ -493,7 +493,7 @@ static int open_path(struct file_desc *d,
 	if (rfi->remap) {
 		mutex_lock(ghost_file_mutex);
 		if (link(rfi->remap->path, rfi->path) < 0) {
-			pr_perror("Can't link %s -> %s\n",
+			pr_perror("Can't link %s -> %s",
 					rfi->remap->path, rfi->path);
 			return -1;
 		}
diff --git a/files.c b/files.c
index ba84e7b..78e0192 100644
--- a/files.c
+++ b/files.c
@@ -141,7 +141,7 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
 	int ret;
 
 	if (fstat(lfd, &p->stat) < 0) {
-		pr_perror("Can't stat fd %d\n", lfd);
+		pr_perror("Can't stat fd %d", lfd);
 		return -1;
 	}
 
@@ -164,7 +164,7 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
 
 	ret = fcntl(lfd, F_GETSIG, 0);
 	if (ret < 0) {
-		pr_perror("Can't get owner signum on %d\n", lfd);
+		pr_perror("Can't get owner signum on %d", lfd);
 		return -1;
 	}
 	p->fown.signum = ret;
@@ -225,7 +225,7 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
 		return dump_chrdev(&p, lfd, fdinfo);
 
 	if (fstatfs(lfd, &statfs)) {
-		pr_perror("Can't obtain statfs on fd %d\n", fd);
+		pr_perror("Can't obtain statfs on fd %d", fd);
 		return -1;
 	}
 
diff --git a/page-xfer.c b/page-xfer.c
index 4a35623..7c15e59 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -187,13 +187,13 @@ int cr_page_server(void)
 
 	sk = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 	if (sk < 0) {
-		pr_perror("Can't init page server\n");
+		pr_perror("Can't init page server");
 		return -1;
 	}
 
 	opts.ps_addr.sin_family = AF_INET;
 	if (bind(sk, (struct sockaddr *)&opts.ps_addr, sizeof(opts.ps_addr))) {
-		pr_perror("Can't bind page server\n");
+		pr_perror("Can't bind page server");
 		goto out;
 	}
 
@@ -232,14 +232,14 @@ int connect_to_page_server(void)
 
 	page_server_sk = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 	if (page_server_sk < 0) {
-		pr_perror("Can't create socket\n");
+		pr_perror("Can't create socket");
 		return -1;
 	}
 
 	opts.ps_addr.sin_family = AF_INET;
 	if (connect(page_server_sk, (struct sockaddr *)&opts.ps_addr,
 				sizeof(opts.ps_addr)) < 0) {
-		pr_perror("Can't connect to server\n");
+		pr_perror("Can't connect to server");
 		return -1;
 	}
 
@@ -257,7 +257,7 @@ static int write_pagemap_to_server(struct page_xfer *xfer,
 	pi.nr_pages = iov->iov_len / PAGE_SIZE;
 
 	if (write(xfer->fd, &pi, sizeof(pi)) != sizeof(pi)) {
-		pr_perror("Can't write pagemap to server\n");
+		pr_perror("Can't write pagemap to server");
 		return -1;
 	}
 
@@ -287,7 +287,7 @@ static int write_hole_to_server(struct page_xfer *xfer, struct iovec *iov)
 	pi.nr_pages = iov->iov_len / PAGE_SIZE;
 
 	if (write(xfer->fd, &pi, sizeof(pi)) != sizeof(pi)) {
-		pr_perror("Can't write pagehole to server\n");
+		pr_perror("Can't write pagehole to server");
 		return -1;
 	}
 
diff --git a/proc_parse.c b/proc_parse.c
index da6a852..049a605 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -1048,7 +1048,7 @@ int parse_fdinfo(int fd, int type,
 	pr_err("No records of type %d found in fdinfo file\n", type);
 parse_err:
 	ret = -1;
-	pr_perror("%s: error parsing [%s] for %d\n", __func__, str, type);
+	pr_perror("%s: error parsing [%s] for %d", __func__, str, type);
 out:
 	fclose(f);
 	return ret;
diff --git a/sk-queue.c b/sk-queue.c
index 7c3c6cd..8676ba3 100644
--- a/sk-queue.c
+++ b/sk-queue.c
@@ -81,7 +81,7 @@ int dump_sk_queue(int sock_fd, int sock_id)
 	orig_peek_off = 0;
 	ret = getsockopt(sock_fd, SOL_SOCKET, SO_PEEK_OFF, &orig_peek_off, &tmp);
 	if (ret < 0) {
-		pr_perror("getsockopt failed\n");
+		pr_perror("getsockopt failed");
 		return ret;
 	}
 	/*
@@ -91,7 +91,7 @@ int dump_sk_queue(int sock_fd, int sock_id)
 	size = 0;
 	ret = getsockopt(sock_fd, SOL_SOCKET, SO_SNDBUF, &size, &tmp);
 	if (ret < 0) {
-		pr_perror("getsockopt failed\n");
+		pr_perror("getsockopt failed");
 		return ret;
 	}
 
@@ -110,7 +110,7 @@ int dump_sk_queue(int sock_fd, int sock_id)
 	 */
 	ret = setsockopt(sock_fd, SOL_SOCKET, SO_PEEK_OFF, &ret, sizeof(int));
 	if (ret < 0) {
-		pr_perror("setsockopt fail\n");
+		pr_perror("setsockopt fail");
 		goto err_brk;
 	}
 
@@ -130,7 +130,7 @@ int dump_sk_queue(int sock_fd, int sock_id)
 		if (ret < 0) {
 			if (errno == EAGAIN)
 				break; /* we're done */
-			pr_perror("recvmsg fail: error\n");
+			pr_perror("recvmsg fail: error");
 			goto err_set_sock;
 		}
 		if (msg.msg_flags & MSG_TRUNC) {
@@ -162,7 +162,7 @@ err_set_sock:
 	 * Restore original peek offset.
 	 */
 	if (setsockopt(sock_fd, SOL_SOCKET, SO_PEEK_OFF, &orig_peek_off, sizeof(int))) {
-		pr_perror("setsockopt failed on restore\n");
+		pr_perror("setsockopt failed on restore");
 		ret = -1;
 	}
 err_brk:
diff --git a/sk-tcp.c b/sk-tcp.c
index e658c34..98c9d40 100644
--- a/sk-tcp.c
+++ b/sk-tcp.c
@@ -563,7 +563,7 @@ int rst_tcp_socks_remap(void *addr)
 			MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
 
 	if (ret != addr) {
-		pr_perror("mmap() failed\n");
+		pr_perror("mmap() failed");
 		return -1;
 	}
 
@@ -628,7 +628,7 @@ int check_tcp(void)
 
 	sk = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 	if (sk < 0) {
-		pr_perror("Can't create TCP socket :(\n");
+		pr_perror("Can't create TCP socket :(");
 		return -1;
 	}
 
diff --git a/sockets.c b/sockets.c
index f0c51b8..b840b91 100644
--- a/sockets.c
+++ b/sockets.c
@@ -192,7 +192,7 @@ static int dump_socket_filter(int sk, SkOptsEntry *soe)
 
 	ret = getsockopt(sk, SOL_SOCKET, SO_GET_FILTER, flt, &len);
 	if (ret) {
-		pr_perror("Can't get socket filter\n");
+		pr_perror("Can't get socket filter");
 		xfree(flt);
 		return ret;
 	}
diff --git a/tty.c b/tty.c
index 9df83b5..ecc5eff 100644
--- a/tty.c
+++ b/tty.c
@@ -200,7 +200,7 @@ static int parse_index(u32 id, int lfd, int major)
 	switch (major) {
 	case TTYAUX_MAJOR:
 		if (ioctl(lfd, TIOCGPTN, &index)) {
-			pr_perror("Can't obtain ptmx index\n");
+			pr_perror("Can't obtain ptmx index");
 			return -1;
 		}
 		break;
@@ -328,7 +328,7 @@ static int lock_pty(int fd)
 static int tty_set_sid(int fd)
 {
 	if (ioctl(fd, TIOCSCTTY, 1)) {
-		pr_perror("Can't set sid on terminal fd %d\n", fd);
+		pr_perror("Can't set sid on terminal fd %d", fd);
 		return -1;
 	}
 
@@ -338,7 +338,7 @@ static int tty_set_sid(int fd)
 static int tty_set_prgp(int fd, int group)
 {
 	if (ioctl(fd, TIOCSPGRP, &group)) {
-		pr_perror("Failed to set group %d on %d\n", group, fd);
+		pr_perror("Failed to set group %d on %d", group, fd);
 		return -1;
 	}
 	return 0;
diff --git a/util.c b/util.c
index b7d6918..b62b0ba 100644
--- a/util.c
+++ b/util.c
@@ -361,7 +361,7 @@ int clone_service_fd(int id)
 		if (ret == -1) {
 			if (errno == EBADF)
 				continue;
-			pr_perror("Unable to clone %d->%d\n", old, new);
+			pr_perror("Unable to clone %d->%d", old, new);
 		}
 	}
 
@@ -495,7 +495,7 @@ int run_scripts(char *action)
 	int ret = 0;
 
 	if (setenv("CRTOOLS_SCRIPT_ACTION", action, 1)) {
-		pr_perror("Can't set CRTOOL_SCRIPT_ACTION=%s\n", action);
+		pr_perror("Can't set CRTOOL_SCRIPT_ACTION=%s", action);
 		return -1;
 	}
 
@@ -536,7 +536,7 @@ int cr_system(int in, int out, int err, char *cmd, char *const argv[])
 
 	pid = fork();
 	if (pid == -1) {
-		pr_perror("fork() failed\n");
+		pr_perror("fork() failed");
 		goto out;
 	} else if (pid == 0) {
 		if (out < 0)
-- 
1.8.1.4



More information about the CRIU mailing list