Date: Thu, 21 Feb 2002 23:32:31 +1030 (CST) From: "Daniel O'Connor" <darius@dons.net.au> To: FreeBSD-gnats-submit@freebsd.org Subject: i386/35182: APMD does not set close on exec for /dev/apm* Message-ID: <200202211302.g1LD2VH01615@chowder.dons.net.au>
next in thread | raw e-mail | index | archive | help
>Number: 35182 >Category: i386 >Synopsis: APMD does not set close on exec for /dev/apm* >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 21 05:10:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Daniel O'Connor >Release: FreeBSD 4.5-STABLE i386 >Organization: >Environment: System: FreeBSD chowder.dons.net.au 4.5-STABLE FreeBSD 4.5-STABLE #4: Mon Feb 11 13:52:27 CST 2002 darius@chowder.gsoft.com.au:/usr/obj/usr/src/sys/CHOWDER i386 >Description: apmd does not set close-on-exec for its APM device file descriptors which leads to problems trying to get the child processes to exit etc.. >How-To-Repeat: Run something from apmd. Observe the child process hold an fd to APM device nodes >Fix: Index: apmd.c =================================================================== RCS file: /usr/CVS-Repository/src/usr.sbin/apmd/apmd.c,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 apmd.c --- apmd.c 13 Aug 2001 17:30:30 -0000 1.3.2.1 +++ apmd.c 21 Feb 2002 12:58:04 -0000 @@ -683,8 +683,16 @@ (void) err(1, "cannot open device file `%s'", APM_NORM_DEVICEFILE); } + if (fcntl(apmnorm_fd, F_SETFD, 1) == -1) { + (void) err(1, "cannot set close-on-exec flag for device file '%s'", APM_NORM_DEVICEFILE); + } + if ((apmctl_fd = open(APM_CTL_DEVICEFILE, O_RDWR)) == -1) { (void) err(1, "cannot open device file `%s'", APM_CTL_DEVICEFILE); + } + + if (fcntl(apmctl_fd, F_SETFD, 1) == -1) { + (void) err(1, "cannot set close-on-exec flag for device file '%s'", APM_CTL_DEVICEFILE); } restart(); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202211302.g1LD2VH01615>