Skip to contentSkip to conversation

stat(2) does not indicate behavior with NULL filename arg, man pages 3.24

DISCUSSION Jeff Mahovsky 3 participants 3 messages Apr 21, 2010 – May 24, 2010 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

The stat(2) manpage does not indicate the behavior of the stat() function when the filename is a NULL pointer. Does stat() return an error or is the behavior undefined?

Jeff Mahovsky
Dreamworks Animation

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · Jeff Mahovsky

The stat(2) manpage does not indicate the behavior of the stat() function when the filename is a NULL pointer. Does stat() return an error or is the behavior undefined?

I think it is generally not safe to rely on proper handling of such NULL pointers unless it is explicitly specified that they are handled correctly. I think e.g. glibc will happily peek at the stat()'s filename if you compile with -fbounded-pointers.

Signature · 7 lines
				Petr "Pasky" Baudis
When I feel like exercising, I just lie down until the feeling
goes away.  -- xed_over
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to a message not in the archive

Jeff

Quoted 6 lines · Jeff Mahovsky

The stat(2) manpage does not indicate the behavior of the stat() function when the filename is a NULL pointer.  Does stat() return an error or is the behavior undefined?

Jeff Mahovsky
Dreamworks Animation

Just to add to what Petr said. A NULL pointer is a general kind of error that can affect many interfaces. I don't really see a need to document this case for a specific interface.

Thanks,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface" http://blog.man7.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html