[08/14] criu/namespaces.c: fix pr_perror usage

Submitted by Kir Kolyshkin on March 21, 2017, 10:01 p.m.

Details

Message ID 20170321220101.21228-9-kir@openvz.org
State New
Series "Spring '07 cleaning"
Headers show

Commit Message

Kir Kolyshkin March 21, 2017, 10:01 p.m.
1. No newline (pr_perror() already adds one for you)

2. No colon before file name, e.g.

WAS:	Can't open file: /some/file: permission denied
NOW:	Can't open file /some/file: permission denied

Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Dengguangxing <dengguangxing@huawei.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
---
 criu/namespaces.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/namespaces.c b/criu/namespaces.c
index a0e7397..48a79a5 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -106,7 +106,7 @@  static int check_ns_file(char *ns_file)
 
 	ret = access(ns_file, 0);
 	if (ret < 0) {
-		pr_perror("Can't access join-ns file: %s", ns_file);
+		pr_perror("Can't access join-ns file %s", ns_file);
 		return -1;
 	}
 	return 0;
@@ -1366,7 +1366,7 @@  static int write_id_map(pid_t pid, UidGidExtent **extents, int n, char *id_map)
 	snprintf(buf, PAGE_SIZE, "%d/%s", pid, id_map);
 	fd = openat(fd, buf, O_WRONLY);
 	if (fd < 0) {
-		pr_perror("Can't open %s\n", buf);
+		pr_perror("Can't open %s", buf);
 		return -1;
 	}
 
@@ -2073,7 +2073,7 @@  static int get_join_ns_fd(struct join_ns *jn)
 
 	fd = open(pnsf, O_RDONLY);
 	if (fd < 0) {
-		pr_perror("Can't open ns file: %s", pnsf);
+		pr_perror("Can't open ns file %s", pnsf);
 		return -1;
 	}
 	jn->ns_fd = fd;
@@ -2254,7 +2254,7 @@  static int create_user_ns_hierarhy_fn(void *in_arg)
 
 		errno = 0;
 		if (wait(&status) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
-			pr_perror("Child process waiting: %d\n", status);
+			pr_perror("Child process waiting: %d", status);
 			goto out;
 		}
 	}

Comments

Kirill Tkhai March 22, 2017, 9:57 a.m.
On 22.03.2017 01:01, Kir Kolyshkin wrote:
> 1. No newline (pr_perror() already adds one for you)
> 
> 2. No colon before file name, e.g.
> 
> WAS:	Can't open file: /some/file: permission denied
> NOW:	Can't open file /some/file: permission denied
> 
> Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
> Cc: Dengguangxing <dengguangxing@huawei.com>
> Signed-off-by: Kir Kolyshkin <kir@openvz.org>

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  criu/namespaces.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/criu/namespaces.c b/criu/namespaces.c
> index a0e7397..48a79a5 100644
> --- a/criu/namespaces.c
> +++ b/criu/namespaces.c
> @@ -106,7 +106,7 @@ static int check_ns_file(char *ns_file)
>  
>  	ret = access(ns_file, 0);
>  	if (ret < 0) {
> -		pr_perror("Can't access join-ns file: %s", ns_file);
> +		pr_perror("Can't access join-ns file %s", ns_file);
>  		return -1;
>  	}
>  	return 0;
> @@ -1366,7 +1366,7 @@ static int write_id_map(pid_t pid, UidGidExtent **extents, int n, char *id_map)
>  	snprintf(buf, PAGE_SIZE, "%d/%s", pid, id_map);
>  	fd = openat(fd, buf, O_WRONLY);
>  	if (fd < 0) {
> -		pr_perror("Can't open %s\n", buf);
> +		pr_perror("Can't open %s", buf);
>  		return -1;
>  	}
>  
> @@ -2073,7 +2073,7 @@ static int get_join_ns_fd(struct join_ns *jn)
>  
>  	fd = open(pnsf, O_RDONLY);
>  	if (fd < 0) {
> -		pr_perror("Can't open ns file: %s", pnsf);
> +		pr_perror("Can't open ns file %s", pnsf);
>  		return -1;
>  	}
>  	jn->ns_fd = fd;
> @@ -2254,7 +2254,7 @@ static int create_user_ns_hierarhy_fn(void *in_arg)
>  
>  		errno = 0;
>  		if (wait(&status) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
> -			pr_perror("Child process waiting: %d\n", status);
> +			pr_perror("Child process waiting: %d", status);
>  			goto out;
>  		}
>  	}
>