Re: [PATCH] uuidd: use die() where possible

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

 



On Wed, Feb 02, 2011 at 01:52:28PM +0100, Petr Uzel wrote:
> On Tue, Feb 01, 2011 at 08:11:43PM -0500, Mike Frysinger wrote:
> > On Tuesday, February 01, 2011 10:19:13 Petr Uzel wrote:
> > > --- a/misc-utils/uuidd.c
> > > +++ b/misc-utils/uuidd.c
> > > @@ -63,12 +63,10 @@ static void create_daemon(void)
> > >  	uid_t euid;
> > > 
> > >  	pid = fork();
> > > -	if (pid == -1) {
> > > -		perror("fork");
> > > -		exit(1);
> > > -	} else if (pid != 0) {
> > > -	    exit(0);
> > > -	}
> > > +	if (pid == -1)
> > > +		die("fork");
> > > +	else if (pid != 0)
> > > +		exit(0);
> > > 
> > >  	close(0);
> > >  	close(1);
> > 
> > somewhat related, this code really should read something like:
> > create_daemon()
> > {
> > 	uid_t euid;
> > 
> > 	if (daemon(0, 0))
> > 		die("daemon");
> > 
> > 	euid = geteuid();
> > 	if (setreuid(euid, euid) < 0)
> > 		die("setreuid");
> > }
> 
> This seems to be a nice simplification. I'm just wondering - would
> that require checking for daemon(3) in configure.ac? 

 We already use daemon(3) in sys-utils/ldattach.c and nobody
 complains (but I have doubts it's available on Solaris). 

 It would be better to do this change after v2.19 release. We have
 people who care about libblkid and libuuid portability, it's not fair
 to modify the code now. 

    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