[CRIU] [PATCH] Fix pr_perror() usage
Andrew Vagin
avagin at odin.com
Fri May 1 03:49:44 PDT 2015
Acked-by: Andrew Vagin <avagin at odin.com>
On Thu, Apr 30, 2015 at 04:25:46PM -0700, Kir Kolyshkin wrote:
> When using pr_perror(), format string should not end with \n,
> as it is added by the macro itself.
>
> Signed-off-by: Kir Kolyshkin <kir at openvz.org>
> ---
> cr-check.c | 4 ++--
> fsnotify.c | 2 +-
> kerndat.c | 2 +-
> mount.c | 2 +-
> namespaces.c | 4 ++--
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/cr-check.c b/cr-check.c
> index 4baf730..7cf796a 100644
> --- a/cr-check.c
> +++ b/cr-check.c
> @@ -649,12 +649,12 @@ static int check_aio_remap(void)
>
> naddr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0);
> if (naddr == MAP_FAILED) {
> - pr_perror("Can't find place for new AIO ring\n");
> + pr_perror("Can't find place for new AIO ring");
> return -1;
> }
>
> if (mremap((void *)ctx, len, len, MREMAP_FIXED | MREMAP_MAYMOVE, naddr) == MAP_FAILED) {
> - pr_perror("Can't remap AIO ring\n");
> + pr_perror("Can't remap AIO ring");
> return -1;
> }
>
> diff --git a/fsnotify.c b/fsnotify.c
> index a069fbe..feca355 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -526,7 +526,7 @@ static int restore_one_fanotify(int fd, struct fsnotify_mark_info *mark)
>
> target = openat(mntns_root, m->mountpoint, O_PATH);
> if (target == -1) {
> - pr_perror("Unable to open %s\n", m->mountpoint);
> + pr_perror("Unable to open %s", m->mountpoint);
> goto err;
> }
>
> diff --git a/kerndat.c b/kerndat.c
> index 6745dbb..2914028 100644
> --- a/kerndat.c
> +++ b/kerndat.c
> @@ -286,7 +286,7 @@ int kerndat_fdinfo_has_lock()
> }
>
> if (flock(fd, LOCK_SH)) {
> - pr_perror("Can't take a lock\n");
> + pr_perror("Can't take a lock");
> return -1;
> }
>
> diff --git a/mount.c b/mount.c
> index d4e2444..6dc48eb 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -2595,7 +2595,7 @@ int prepare_mnt_ns(void)
> /* Unprivileged users can't reveal what is under a mount */
> if (root_ns_mask & CLONE_NEWUSER) {
> if (mount(opts.root, opts.root, NULL, MS_BIND | MS_REC, NULL)) {
> - pr_perror("Can't remount bind-mount %s into itself\n", opts.root);
> + pr_perror("Can't remount bind-mount %s into itself", opts.root);
> return -1;
> }
> }
> diff --git a/namespaces.c b/namespaces.c
> index 9fdd9b3..e074dd9 100644
> --- a/namespaces.c
> +++ b/namespaces.c
> @@ -607,7 +607,7 @@ static int check_user_ns(int pid)
>
> chld = fork();
> if (chld == -1) {
> - pr_perror("Unable to fork a process\n");
> + pr_perror("Unable to fork a process");
> return -1;
> }
>
> @@ -829,7 +829,7 @@ static int write_id_map(pid_t pid, UidGidExtent **extents, int n, char *id_map)
> if (fd < 0)
> return -1;
> if (write(fd, buf, off) != off) {
> - pr_perror("Unable to write into %s\n", id_map);
> + pr_perror("Unable to write into %s", id_map);
> close(fd);
> return -1;
> }
> --
> 1.9.3
>
More information about the CRIU
mailing list