Page MenuHomeFreeBSD

D53026.id.diff
No OneTemporary

D53026.id.diff

diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -212,7 +212,7 @@
char *
__ssp_real(realpath)(const char * __restrict path, char * __restrict resolved)
{
- char *m, *res;
+ char *m = NULL, *res = NULL;
if (path == NULL) {
errno = EINVAL;
@@ -222,17 +222,14 @@
errno = ENOENT;
return (NULL);
}
- if (resolved != NULL) {
- m = NULL;
- } else {
- m = resolved = malloc(PATH_MAX);
- if (resolved == NULL)
+ if (resolved == NULL) {
+ if ((resolved = m = malloc(PATH_MAX)) == NULL)
return (NULL);
}
- if (__sys___realpathat(AT_FDCWD, path, resolved, PATH_MAX, 0) == 0) {
- return (resolved);
- }
- res = realpath1(path, resolved);
+ if (__sys___realpathat(AT_FDCWD, path, resolved, PATH_MAX, 0) == 0)
+ res = resolved;
+ else if (errno == ENOSYS || m == NULL)
+ res = realpath1(path, resolved);
if (res == NULL)
free(m);
return (res);

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 18, 12:08 PM (25 m, 18 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31718280
Default Alt Text
D53026.id.diff (957 B)

Event Timeline