https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200580

            Bug ID: 200580
           Summary: superfluous/unnecessary endhostent() does close(0) by
                    accident. libc resolver dns fd close
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

Calling endhostent(), when such a call is not needed,
ends up closing fd 0 by accident.

main()
{
        endhostent();
}

Breakpoint 2, 0x281a8dc0 in close () from /lib/libc.so.7
(gdb) where
#0  0x281a8dc0 in close () from /lib/libc.so.7
#1  0x28152518 in __res_nclose () from /lib/libc.so.7
#2  0x2817c585 in __dns_getanswer () from /lib/libc.so.7
#3  0x080485b3 in main () at endhostent_bug.c:4

hopo $ truss ./a.out
...
close(0)                                         = 0 (0x0)
...
process exit, rval = 0

Except the usual runtime chores, close(0) is the only visible systemcall.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to