Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2009 21:21:04 +1000 (EST)
From:      Mark Andrews <Mark_Andrews@isc.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/134537: misc/e2fsprogs-libuuid closes too manu descriptors [patch]
Message-ID:  <200905141121.n4EBL4kd045895@drugs.dv.isc.org>
Resent-Message-ID: <200905141130.n4EBU1Tp075402@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905141121.n4EBL4kd045895>