This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3][BZ 21340] add support for POSIX_SPAWN_SETSID


* Adhemerval Zanella:

> +static int
> +do_test_setsid (bool test_setsid)

This should return void.

> +  if (test_setsid)
> +    {
> +      if (posix_spawnattr_setflags (&attrp, POSIX_SPAWN_SETSID))
> +	FAIL_EXIT1 ("posix_spawnattr_setflags: %m");
> +    }

You need to set errno before you can use %m.

> +  res = posix_spawnp (&child, "true", NULL, &attrp, args, environ);
> +  /* posix_spawnattr_destroy is noop.  */
> +  posix_spawnattr_destroy (&attrp);
> +
> +  if (res != 0)
> +    FAIL_EXIT1 ("posix_spawnp: %m");

Likewise.

> +static int
> +do_test (void)
> +{
> +  int ret = 0;
> +
> +  ret += do_test_setsid (false);
> +  ret += do_test_setsid (true);
> +
> +  return 0;
> +}

ret is effectively unused.

> diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
> index d7f9e83..3cf77d5 100644
> --- a/sysdeps/unix/sysv/linux/spawni.c
> +++ b/sysdeps/unix/sysv/linux/spawni.c

> +  if ((attr->__flags & POSIX_SPAWN_SETSID) != 0
> +      && (ret = __setsid ()) < 0)
> +    goto fail;

I believe the assignment to ret is dead.

> +
>    /* Set the process group ID.  */
>    if ((attr->__flags & POSIX_SPAWN_SETPGROUP) != 0
>        && (ret = __setpgid (0, attr->__pgrp)) != 0)

Apparently, this is an existing problem with the code ...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]