name in RESOLVED. */
/* we choose to handle __resolved==NULL as crash :) */
extern char *realpath (__const char *__restrict __name,
- char *__restrict __resolved) __THROW __wur __nonnull((2));
+ char *__restrict __resolved) __THROW __wur;
#endif
__set_errno(ENAMETOOLONG);
return NULL;
}
+
+ if (!got_path) {
+ got_path = malloc(PATH_MAX);
+ if (!got_path) {
+ __set_errno(ENOMEM);
+ return NULL;
+ }
+ }
+
/* Copy so that path is at the end of copy_path[] */
strcpy(copy_path + (PATH_MAX-1) - path_len, path);
path = copy_path + (PATH_MAX-1) - path_len;