[CRIU] Re: [PATCH 3/4] pr_perror(): print error at the end of line

Kirill Kolyshkin kir at parallels.com
Mon Jan 30 12:33:48 EST 2012


I thought about it, but it's pretty complicated to insert %m or %s into the passed string right before \n. I mean, i can't think of a way to do it.

The other solution is to make all the helpers add \n.

Yet another option is to rename pr_perror into something not resembling other helpers.

Yet another option is to explicitly add %m into all pr_perror invocations (ie just use pr_err instead). Chances are high it will be forgotten from time to time, so not a good idea.

Cyrill Gorcunov <gorcunov at openvz.org> wrote:


On Mon, Jan 30, 2012 at 09:18:39PM +0400, Kir Kolyshkin wrote:
> This is a standard convention to print error message (i.e. strerror(errno))
> at the end of line, like this:
>
>       Cannot remove file: Permission denied
>
> So pr_perror is fixed to follow this convention (using GNU extension
> %m helps a lot here). Unfortunately, due to this we have to make
> pr_perror() print a new line character, too, so we had to strip it
> from the all pr_perror() invocations.
>
> Signed-off-by: Kir Kolyshkin <kir at openvz.org>
> ---

Hi Kir, actually I don't like it, we have a number of pr_ helpers
(the idea in first place was to be similar to pr_ helpers used
 in kernel) so this pr_perror become a special one from the whole
pr_ helpers set in terms of "implicit new line at the end".

Kir, can we somehow bring back "explicit \n" at the end somehow?

p.s.: though, if Pavel prefer new convention I will apply the patch.

        Cyrill



More information about the CRIU mailing list