diff options
Diffstat (limited to 'guts/realpath.c')
-rw-r--r-- | guts/realpath.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/guts/realpath.c b/guts/realpath.c new file mode 100644 index 0000000..5b1a5f8 --- /dev/null +++ b/guts/realpath.c @@ -0,0 +1,27 @@ +/* + * static char * + * wrap_realpath(const char *name, char *resolved_name) { + * char * rc = NULL; + */ + char *rname = PSEUDO_ROOT_PATH(AT_FDCWD, name, 0); + size_t len; + if (!rname) { + errno = ENAMETOOLONG; + return NULL; + } + if ((len = strlen(rname)) >= pseudo_sys_path_max()) { + free(rname); + errno = ENAMETOOLONG; + return NULL; + } + if (resolved_name) { + memcpy(resolved_name, rname, len + 1); + free(rname); + rc = resolved_name; + } else { + rc = rname; + } + +/* return rc; + * } + */ |