1 .\" Copyright 2013 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" (Replaces an earlier page by Walter Harms and Michael Kerrisk)
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH CANONICALIZE_FILE_NAME 3 2017-09-15 "GNU" "Linux Programmer's Manual"
28 canonicalize_file_name \- return the canonicalized absolute pathname
30 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
32 .B #include <stdlib.h>
34 .BI "char *canonicalize_file_name(const char *" path ");"
37 .BR canonicalize_file_name ()
38 function returns a null-terminated string containing
39 the canonicalized absolute pathname corresponding to
41 In the returned string, symbolic links are resolved, as are
48 characters are replaced by a single slash.
50 The returned string is dynamically allocated by
51 .BR canonicalize_file_name ()
52 and the caller should deallocate it with
54 when it is no longer required.
57 .I canonicalize_file_name(path)
58 is equivalent to the call:
63 .BR canonicalize_file_name ()
64 returns a null-terminated string.
65 On error (e.g., a pathname component is unreadable or does not exist),
66 .BR canonicalize_file_name ()
69 to indicate the error.
74 For an explanation of the terms used in this section, see
80 Interface Attribute Value
82 .BR canonicalize_file_name ()
83 T} Thread safety MT-Safe
86 This function is a GNU extension.