public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/5605] New: dirfd() SEGVs when passed NULL
@ 2008-01-13 15:21 steve at fisharerojo dot org
  2008-01-13 15:59 ` [Bug libc/5605] " schwab at suse dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: steve at fisharerojo dot org @ 2008-01-13 15:21 UTC (permalink / raw)
  To: glibc-bugs

The following example program SEGVs in dirfd() in libc.  Based on the manpage, it should be returning 
-1.

#include <sys/types.h>
#include <dirent.h>
#include <stdlib.h>

int
main() {
    int fd = dirfd(NULL);
}

-- 
           Summary: dirfd() SEGVs when passed NULL
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: steve at fisharerojo dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5605

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/5605] dirfd() SEGVs when passed NULL
  2008-01-13 15:21 [Bug libc/5605] New: dirfd() SEGVs when passed NULL steve at fisharerojo dot org
@ 2008-01-13 15:59 ` schwab at suse dot de
  2008-01-14  3:13 ` steve at fisharerojo dot org
  2008-01-14  3:17 ` roland at gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab at suse dot de @ 2008-01-13 15:59 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From schwab at suse dot de  2008-01-13 15:59 -------
The argument must be a pointer to a valid directory stream.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=5605

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/5605] dirfd() SEGVs when passed NULL
  2008-01-13 15:21 [Bug libc/5605] New: dirfd() SEGVs when passed NULL steve at fisharerojo dot org
  2008-01-13 15:59 ` [Bug libc/5605] " schwab at suse dot de
@ 2008-01-14  3:13 ` steve at fisharerojo dot org
  2008-01-14  3:17 ` roland at gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: steve at fisharerojo dot org @ 2008-01-14  3:13 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From steve at fisharerojo dot org  2008-01-14 03:13 -------
(In reply to comment #1)
> The argument must be a pointer to a valid directory stream.

...and if it isn't libc should SEGV.  That seems very illogical.  It would seem to make much more sense to 
return -1 and set errno to EBADF.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


http://sourceware.org/bugzilla/show_bug.cgi?id=5605

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/5605] dirfd() SEGVs when passed NULL
  2008-01-13 15:21 [Bug libc/5605] New: dirfd() SEGVs when passed NULL steve at fisharerojo dot org
  2008-01-13 15:59 ` [Bug libc/5605] " schwab at suse dot de
  2008-01-14  3:13 ` steve at fisharerojo dot org
@ 2008-01-14  3:17 ` roland at gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: roland at gnu dot org @ 2008-01-14  3:17 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From roland at gnu dot org  2008-01-14 03:17 -------
You are mistaken in your expectation.  Crashing is the very best thing to do and
this is widely accepted.   Do not reopen a bug for this behavior.  Please seek
advice on best practices for C interfaces elsewhere.  This facility is for bugs
in glibc.  This is not one.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=5605

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-14  3:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-13 15:21 [Bug libc/5605] New: dirfd() SEGVs when passed NULL steve at fisharerojo dot org
2008-01-13 15:59 ` [Bug libc/5605] " schwab at suse dot de
2008-01-14  3:13 ` steve at fisharerojo dot org
2008-01-14  3:17 ` roland at gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).