Bug 1345

Summary: closefromtest fails, sometimes
Product: Portable OpenSSH Reporter: David Leonard <David.Leonard>
Component: MiscellaneousAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: dtucker
Priority: P2    
Version: 4.6p1   
Hardware: amd64   
OS: Linux   

Description David Leonard 2007-07-25 12:07:18 AEST
sometimes opebsd-compat/regress/closefromtest fails with
   closefrom: closed descriptors it should not have
(On Red Hat EL 3 x86_64)

This is because /dev/null is not being opened for read properly.

--- openssh/openbsd-compat/regress/closefromtest.c      (revision 160)
+++ openssh/openbsd-compat/regress/closefromtest.c      (working copy)
@@ -38,7 +38,7 @@
        char buf[512];
 
        for (i = 0; i < NUM_OPENS; i++)
-               if ((fds[i] = open("/dev/null", "r")) == -1)
+               if ((fds[i] = open("/dev/null", O_RDONLY)) == -1)
                        exit(0);        /* can't test */
        max = i - 1;
Comment 1 Tim Rice 2007-07-25 13:55:09 AEST
Nice catch. The fix should show up in the next snapshot.
Comment 2 Darren Tucker 2007-07-25 14:16:35 AEST
(In reply to comment #1)
> Nice catch. The fix should show up in the next snapshot.

In the interests of fairness: Bernard Simon also reported this to me a while back.  So, credit to him too, and an anti-credit to me for slacking.

Comment 3 Damien Miller 2008-04-04 10:00:24 AEDT
Close resolved bugs after release.