This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/13908] New: mktemp() incorrectly flagged with __wur in stdlib.h
- From: "dvw at phas dot ubc.ca" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Tue, 27 Mar 2012 21:21:02 +0000
- Subject: [Bug libc/13908] New: mktemp() incorrectly flagged with __wur in stdlib.h
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=13908
Bug #: 13908
Summary: mktemp() incorrectly flagged with __wur in stdlib.h
Product: glibc
Version: 2.15
Status: NEW
Severity: minor
Priority: P2
Component: libc
AssignedTo: unassigned@sourceware.org
ReportedBy: dvw@phas.ubc.ca
CC: drepper.fsp@gmail.com
Classification: Unclassified
stdlib.h contains:
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */
extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
The documentation here is incorrect: mktemp() always returns TEMPLATE, and sets
template[0] to 0 on failure, as required by POSIX.
Consequently, this declaration should not be marked with __wur. The caller
gains no information by inspecting the return value of mktemp(). (Instead, it
should be checking template[0] to detect failure.)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.