1 .\" Copyright 2013 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" (Replaces an earlier page by Walter Harms and Michael Kerrisk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH canonicalize_file_name 3 (date) "Linux man-pages (unreleased)"
8 canonicalize_file_name \- return the canonicalized absolute pathname
11 .RI ( libc ", " \-lc )
14 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
15 .B #include <stdlib.h>
17 .BI "char *canonicalize_file_name(const char *" path ");"
21 .BR canonicalize_file_name ()
22 function returns a null-terminated string containing
23 the canonicalized absolute pathname corresponding to
25 In the returned string, symbolic links are resolved, as are
32 characters are replaced by a single slash.
34 The returned string is dynamically allocated by
35 .BR canonicalize_file_name ()
36 and the caller should deallocate it with
38 when it is no longer required.
41 .I canonicalize_file_name(path)
42 is equivalent to the call:
51 .BR canonicalize_file_name ()
52 returns a null-terminated string.
53 On error (e.g., a pathname component is unreadable or does not exist),
54 .BR canonicalize_file_name ()
57 to indicate the error.
62 For an explanation of the terms used in this section, see
70 Interface Attribute Value
72 .BR canonicalize_file_name ()
73 T} Thread safety MT-Safe
79 This function is a GNU extension.