This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13908] New: mktemp() incorrectly flagged with __wur in stdlib.h

             Bug #: 13908
           Summary: mktemp() incorrectly flagged with __wur in stdlib.h
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: minor
          Priority: P2
         Component: libc
    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:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]