[CRIU] [PATCH] pr_perror(): don't end message with a period

Kir Kolyshkin kir at openvz.org
Thu Dec 12 10:15:46 PST 2013


When pr_perror is used, an error message is appended with a comma
and an strerror(errno), so we should not put a period at the end,
otherwise we'll end up with something like this:

	Error: Can't bind.: Permission denied

Found by git grep -w pr_perror | grep '\."'

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 cr-service.c | 14 +++++++-------
 image.c      |  4 ++--
 ptrace.c     |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/cr-service.c b/cr-service.c
index ba498b4..01aa5a5 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -99,7 +99,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 	char images_dir_path[PATH_MAX];
 
 	if (getsockopt(sk, SOL_SOCKET, SO_PEERCRED, &ids, &ids_len)) {
-		pr_perror("Can't get socket options.");
+		pr_perror("Can't get socket options");
 		return -1;
 	}
 
@@ -132,7 +132,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 
 	log_set_loglevel(req->log_level);
 	if (log_init(opts.output) == -1) {
-		pr_perror("Can't initiate log.");
+		pr_perror("Can't initiate log");
 		return -1;
 	}
 
@@ -343,7 +343,7 @@ int cr_service(bool daemon_mode)
 
 	server_fd = socket(AF_LOCAL, SOCK_SEQPACKET, 0);
 	if (server_fd == -1) {
-		pr_perror("Can't initialize service socket.");
+		pr_perror("Can't initialize service socket");
 		goto err;
 	}
 
@@ -364,7 +364,7 @@ int cr_service(bool daemon_mode)
 
 	if (bind(server_fd, (struct sockaddr *) &server_addr,
 					server_addr_len) == -1) {
-		pr_perror("Can't bind.");
+		pr_perror("Can't bind");
 		goto err;
 	}
 
@@ -372,12 +372,12 @@ int cr_service(bool daemon_mode)
 
 	/* change service socket permissions, so anyone can connect to it */
 	if (chmod(server_addr.sun_path, 0666)) {
-		pr_perror("Can't change permissions of the service socket.");
+		pr_perror("Can't change permissions of the service socket");
 		goto err;
 	}
 
 	if (listen(server_fd, 16) == -1) {
-		pr_perror("Can't listen for socket connections.");
+		pr_perror("Can't listen for socket connections");
 		goto err;
 	}
 
@@ -405,7 +405,7 @@ int cr_service(bool daemon_mode)
 
 		sk = accept(server_fd, &client_addr, &client_addr_len);
 		if (sk == -1) {
-			pr_perror("Can't accept connection.");
+			pr_perror("Can't accept connection");
 			goto err;
 		}
 
diff --git a/image.c b/image.c
index 2a59d99..2fde5e2 100644
--- a/image.c
+++ b/image.c
@@ -246,13 +246,13 @@ int open_image_dir(char *dir)
 
 		ret = symlinkat(opts.img_parent, fd, CR_PARENT_LINK);
 		if (ret < 0) {
-			pr_perror("Can't link parent snapshot.");
+			pr_perror("Can't link parent snapshot");
 			goto err;
 		}
 
 		pfd = openat(fd, CR_PARENT_LINK, O_RDONLY);
 		if (pfd < 0) {
-			pr_perror("Can't open parent snapshot.");
+			pr_perror("Can't open parent snapshot");
 			goto err;
 		}
 
diff --git a/ptrace.c b/ptrace.c
index b3b8241..7771095 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -126,7 +126,7 @@ try_again:
 
 		if (ptrace(PTRACE_CONT, pid, NULL,
 					(void *)(unsigned long)si.si_signo)) {
-			pr_perror("Can't continue signal handling. Aborting.");
+			pr_perror("Can't continue signal handling, aborting");
 			goto err;
 		}
 
-- 
1.8.1.4



More information about the CRIU mailing list