2 .\" Copyright 2013 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" (Replaces an earlier page by Walter Harms and Michael Kerrisk)
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH canonicalize_file_name 3 (date) "Linux man-pages (unreleased)"
9 canonicalize_file_name \- return the canonicalized absolute pathname
12 .RI ( libc ", " \-lc )
15 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
16 .B #include <stdlib.h>
18 .BI "char *canonicalize_file_name(const char *" path ");"
22 .BR canonicalize_file_name ()
23 function returns a null-terminated string containing
24 the canonicalized absolute pathname corresponding to
26 In the returned string, symbolic links are resolved, as are
33 characters are replaced by a single slash.
35 The returned string is dynamically allocated by
36 .BR canonicalize_file_name ()
37 and the caller should deallocate it with
39 when it is no longer required.
42 .I canonicalize_file_name(path)
43 is equivalent to the call:
52 .BR canonicalize_file_name ()
53 returns a null-terminated string.
54 On error (e.g., a pathname component is unreadable or does not exist),
55 .BR canonicalize_file_name ()
58 to indicate the error.
63 For an explanation of the terms used in this section, see
69 Interface Attribute Value
73 .BR canonicalize_file_name ()
74 T} Thread safety MT-Safe