ports/134537: misc/e2fsprogs-libuuid closes too manu descriptors [patch]

[ Available lists | Index of freebsd-ports-bugs | Month of May 2009 | Week of 14 May 2009 | Raw email | View thread | Wrap long lines | Reply ]
From
Mark Andrews <Mark_Andrews@isc.org>
Date
14 May 2009 11:30:01
Subject
ports/134537: misc/e2fsprogs-libuuid closes too manu descriptors [patch]
Message-ID
200905141121.n4EBL4kd045895@drugs.dv.isc.org


[ Hide this part ]
 
>Number: 134537
>Category: ports
>Synopsis: misc/e2fsprogs-libuuid closes too manu descriptors [patch]
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu May 14 11:30:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Mark Andrews
>Release: FreeBSD 6.4-STABLE i386
>Organization:
ISC
>Environment:
System: FreeBSD drugs.dv.isc.org 6.4-STABLE FreeBSD 6.4-STABLE #31: Thu Apr 30 07:41:29 EST 2009 marka@drugs.dv.isc.org:/usr/obj/usr/src/sys/DRUGS i386


>Description:

close_all_fds() is called just before execing uuidd which results
in a uuidd start with no file descriptors open. This is not
expected and results in uuidd accidently closing the socket
it just opened when it becomes a daemon.

See also ports/134526 and ports/134535.

>How-To-Repeat:

>Fix:

Don't close descriptor 0, 1 and 2 or close and re-open with
/dev/null. Since uuidd is invoked in a manner that will
result in it closing these descriptors I choose the former.

--- gen_uuid.c.orig 2009-05-14 21:12:51.000000000 +1000
+++ gen_uuid.c 2009-05-14 21:12:15.000000000 +1000
@@ -436,7 +436,7 @@
}

/*
- * Close all file descriptors
+ * Close all file descriptors except for stdio.
*/
static void close_all_fds(void)
{
@@ -455,7 +455,7 @@
max = OPEN_MAX;
#endif

- for (i=0; i < max; i++)
+ for (i=3; i < max; i++)
close(i);
}

>Release-Note:
>Audit-Trail:
>Unformatted:


Elapsed time: 0.081 seconds