Re: [PATCH] setpriv: implement option to restore parent death signal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 06, 2018 at 08:13:42AM +0100, Patrick Steinhardt wrote:
> +static void dump_pdeathsig(void)
> +{
> +	const char *signame;
> +	int pdeathsig;
> +
> +	if (prctl(PR_GET_PDEATHSIG, &pdeathsig) != 0) {
> +		warn(_("get pdeathsig failed"));
> +		return;
> +	}
> +
> +	printf("Parent death signal: ");
> +	if (pdeathsig && get_signame_by_idx(pdeathsig, &signame, NULL) == 0)

We use get_signame_by_idx() to list signals. I guess you want to use
signum_to_signame().

> +		printf("%s\n", signame);
> +	else if (pdeathsig)
> +		printf("%d\n", pdeathsig);
> +	else
> +		printf("[none]\n");
> +}
> +

....

> +		case KEEP_PDEATHSIG:
> +			if (opts.pdeathsig)
> +				errx(EXIT_FAILURE,
> +				     _("duplicate --keep-pdeathsig option"));
> +			if (prctl(PR_GET_PDEATHSIG, &opts.pdeathsig) != 0)
> +				errx(SETPRIV_EXIT_PRIVERR,
> +				     _("failed to get parent death signature"));
> +			break;

Good idea, but what about to make it usable for more use-cases:

    --pdeathsig [keep|clear|<signame>]

then we will have command line interface to completely control 
PR_SET_PDEATHSIG ;-)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux