This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation
- From: "lemke_juergen at yahoo dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 26 Oct 2006 05:38:20 -0000
- Subject: [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation
- Reply-to: sourceware-bugzilla at sourceware dot org
In GNU libc 2.3.5, the header file /usr/lib/stdlib.h reads:
#ifdef __USE_GNU
/* Return a malloc'd string containing the canonical absolute name of the
named file. The last file name component need not exist, and may be a
symlink to a nonexistent file. */
extern char *canonicalize_file_name (__const char *__name)
__THROW __nonnull ((1));
#endif
However, canonicalize_file_name() returns NULL when passed a path where the last
component does not exist.
// file: can-test.c
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
char *p = canonicalize_file_name("no-such-file");
if (!p)
perror(NULL);
return 0;
}
The same applies to realpath() and its description. As of version 2.3.5, either
the documentation or the implementation is wrong.
Best
Juergen Lemke
--
Summary: canonicalize_file_name's behavior differs from
documentation
Product: glibc
Version: 2.3.5
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: lemke_juergen at yahoo dot de
CC: glibc-bugs at sources dot redhat dot com,lemke_juergen
at yahoo dot de
http://sourceware.org/bugzilla/show_bug.cgi?id=3426
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.