[09/14] criu/namespaces.c: correct pr_err vs pr_perror usage

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

Details

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

Commit Message

Kir Kolyshkin March 21, 2017, 10:01 p.m.
So, in places where we have errno available (and it makes sense
to show it), we want to use pr_perror().

In places where errno is not set/used, use pr_err().

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

Patch hide | download patch | download mbox

diff --git a/criu/namespaces.c b/criu/namespaces.c
index 48a79a5..80c0014 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -50,7 +50,7 @@  int check_namespace_opts(void)
 {
 	errno = 22;
 	if (join_ns_flags & opts.empty_ns) {
-		pr_perror("Conflict flags: -join-ns and -empty-ns");
+		pr_err("Conflicting flags: --join-ns and --empty-ns\n");
 		return -1;
 	}
 	if (join_ns_flags & CLONE_NEWUSER)
@@ -93,12 +93,13 @@  static int check_ns_file(char *ns_file)
 	if (!check_int_str(ns_file)) {
 		pid = atoi(ns_file);
 		if (pid <= 0) {
-			pr_perror("Invalid join_ns pid %s", ns_file);
+			pr_err("Invalid join_ns pid %s\n", ns_file);
 			return -1;
 		}
 		proc_dir = open_pid_proc(pid);
 		if (proc_dir < 0) {
-			pr_perror("Invalid join_ns pid: /proc/%s not found", ns_file);
+			pr_err("Invalid join_ns pid: /proc/%s not found\n",
+					ns_file);
 			return -1;
 		}
 		return 0;
@@ -2356,7 +2357,7 @@  int __set_user_ns(struct ns_id *ns)
 
 	fd = fdstore_get(ns->user.nsfd_id);
 	if (fd < 0) {
-		pr_perror("Can't get ns fd");
+		pr_err("Can't get ns fd\n");
 		return -1;
 	}
 	if (setns(fd, CLONE_NEWUSER) < 0) {