[CRIU] [PATCH 3/3] test/zdtm: pr_perror() sanitization

Kir Kolyshkin kir at openvz.org
Fri Nov 18 11:41:31 PST 2016


Don't append \n as pr_perror() already does it for us.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 test/zdtm/static/autofs.c                  | 16 ++++++++--------
 test/zdtm/static/mntns_shared_vs_private.c |  4 ++--
 test/zdtm/static/seccomp_filter.c          |  2 +-
 test/zdtm/static/socket_close_data01.c     |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c
index e07e69f..2cfeb51 100644
--- a/test/zdtm/static/autofs.c
+++ b/test/zdtm/static/autofs.c
@@ -127,7 +127,7 @@ static int setup_direct(struct autofs_params *p)
 	}
 	p->fd = open(path, O_CREAT | O_EXCL, 0600);
 	if (p->fd < 0) {
-		pr_perror("%d: failed to open file %s\n", getpid(), path);
+		pr_perror("%d: failed to open file %s", getpid(), path);
 		return -errno;
 	}
 	if (fstat(p->fd, &p->fd_stat)) {
@@ -149,7 +149,7 @@ static int setup_indirect(struct autofs_params *p)
 	}
 	p->fd = open(path, O_CREAT | O_EXCL, 0600);
 	if (p->fd < 0) {
-		pr_perror("%d: failed to open file %s\n", getpid(), path);
+		pr_perror("%d: failed to open file %s", getpid(), path);
 		return -errno;
 	}
 	if (fstat(p->fd, &p->fd_stat)) {
@@ -301,7 +301,7 @@ static int autofs_dev_open(void)
 
 	fd = open(AUTOFS_DEV, O_RDONLY);
 	if (fd == -1) {
-		pr_perror("failed to open /dev/autofs\n");
+		pr_perror("failed to open /dev/autofs");
 		return -errno;
 	}
 	return fd;
@@ -323,7 +323,7 @@ static int autofs_open_mount(int devid, const char *mountpoint)
 	strcpy(param->path, mountpoint);
 
 	if (ioctl(autofs_dev, AUTOFS_DEV_IOCTL_OPENMOUNT, param) < 0) {
-		pr_perror("failed to open autofs mount %s\n", mountpoint);
+		pr_perror("failed to open autofs mount %s", mountpoint);
 		return -errno;
 	}
 
@@ -564,7 +564,7 @@ static int automountd(struct autofs_params *p, int control_fd)
 
 	ret = 0;
 	if (write(control_fd, &ret, sizeof(ret)) != sizeof(ret)) {
-		pr_perror("failed to send result\n");
+		pr_perror("failed to send result");
 		goto err;
 	}
 	close(control_fd);
@@ -572,7 +572,7 @@ static int automountd(struct autofs_params *p, int control_fd)
 
 err:
 	if (write(control_fd, &ret, sizeof(ret) != sizeof(ret))) {
-		pr_perror("failed to send result\n");
+		pr_perror("failed to send result");
 		return -errno;
 	}
 	return ret;
@@ -593,7 +593,7 @@ static int start_automounter(struct autofs_params *p)
 	pid = test_fork();
 	switch (pid) {
 		case -1:
-			pr_perror("failed to fork\n");
+			pr_perror("failed to fork");
 			return -1;
 		case 0:
 			close(control_fd[0]);
@@ -679,7 +679,7 @@ static int setup_catatonic(struct autofs_params *p)
 
 	p->fd = open(path, O_CREAT | O_EXCL, 0600);
 	if (p->fd >= 0) {
-		pr_perror("%d: was able to open file %s on catatonic mount\n", getpid(), path);
+		pr_perror("%d: was able to open file %s on catatonic mount", getpid(), path);
 		return -EINVAL;
 	}
 	free(path);
diff --git a/test/zdtm/static/mntns_shared_vs_private.c b/test/zdtm/static/mntns_shared_vs_private.c
index 5664835..771480b 100644
--- a/test/zdtm/static/mntns_shared_vs_private.c
+++ b/test/zdtm/static/mntns_shared_vs_private.c
@@ -90,11 +90,11 @@ int main(int argc, char **argv)
 	test_waitsig();
 
 	if (umount(path)) {
-		pr_perror("Unable to umount %s\n", path);
+		pr_perror("Unable to umount %s", path);
 		return 1;
 	}
 	if (umount(dirname)) {
-		pr_perror("Unable to umount %s\n", dirname);
+		pr_perror("Unable to umount %s", dirname);
 		return 1;
 	}
 
diff --git a/test/zdtm/static/seccomp_filter.c b/test/zdtm/static/seccomp_filter.c
index d14d656..36295a2 100644
--- a/test/zdtm/static/seccomp_filter.c
+++ b/test/zdtm/static/seccomp_filter.c
@@ -175,7 +175,7 @@ int main(int argc, char ** argv)
 	}
 
 	if (WTERMSIG(status) != SIGSYS) {
-		pr_perror("expected SIGSYS, got %d\n", WTERMSIG(status));
+		pr_perror("expected SIGSYS, got %d", WTERMSIG(status));
 		exit(1);
 	}
 
diff --git a/test/zdtm/static/socket_close_data01.c b/test/zdtm/static/socket_close_data01.c
index 53b5f7a..123e882 100644
--- a/test/zdtm/static/socket_close_data01.c
+++ b/test/zdtm/static/socket_close_data01.c
@@ -31,12 +31,12 @@ static int client(const char *iter)
 	strcpy(addr.sun_path, filename);
 
 	if (connect(sk, (void *)&addr, sizeof(struct sockaddr_un)) < 0) {
-		pr_perror("connect failed %s\n", iter);
+		pr_perror("connect failed %s", iter);
 		return 1;
 	}
 
 	if (send(sk, MSG, sizeof(MSG), 0) != sizeof(MSG)) {
-		pr_perror("send failed %s\n", iter);
+		pr_perror("send failed %s", iter);
 		return 1;
 	}
 
-- 
2.7.4



More information about the CRIU mailing list