diff options
Diffstat (limited to 'ports/unix/guts/realpath.c')
-rw-r--r-- | ports/unix/guts/realpath.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ports/unix/guts/realpath.c b/ports/unix/guts/realpath.c new file mode 100644 index 0000000..8059f5e --- /dev/null +++ b/ports/unix/guts/realpath.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Wind River Systems; see + * guts/COPYRIGHT for information. + * + * static char * + * wrap_realpath(const char *name, char *resolved_name) { + * char * rc = NULL; + */ + char *rname = PSEUDO_ROOT_PATH(AT_FDCWD, name, 0); + ssize_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; + * } + */ |