Re: [PATCH 2/2] libmount: Fix mnt_context_is_child()

Karel Zak
2013-10-11T08:55:27Z

On Thu, Oct 10, 2013 at 12:17:09AM +0900, Namhyung Kim wrote:
> It should check if fork (mount -F) is enabled.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> libmount/src/context.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libmount/src/context.c b/libmount/src/context.c
> index 04eb286..a4d9824 100644
> --- a/libmount/src/context.c
> +++ b/libmount/src/context.c
> @@ -387,7 +387,7 @@ int mnt_context_is_parent(struct libmnt_context *cxt)
> */
> int mnt_context_is_child(struct libmnt_context *cxt)
> {
> - return !mnt_context_is_fork(cxt) && cxt->pid;
> + return mnt_context_is_fork(cxt) && cxt->pid;
> }

No, the code is correct, the function docs is incorrect. The fork
flag is disabled in all children (see mnt_fork_context()) to avoid
recursive forking.

I have fixed the function comment.

Karel

--
Karel Zak <kzak@redhat.com>