From fbedacfc8caa1ec8f14e664a881cb0a93c8f8712 Mon Sep 17 00:00:00 2001 From: Jérémie Koenig Date: Fri, 26 Mar 2010 19:08:53 +0100 Subject: Hurd compat fixes. Mostly dealing with absent PATH_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Koenig Signed-off-by: Denys Vlasenko --- coreutils/realpath.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'coreutils') diff --git a/coreutils/realpath.c b/coreutils/realpath.c index 28906ba55..90a71ed7d 100644 --- a/coreutils/realpath.c +++ b/coreutils/realpath.c @@ -17,30 +17,20 @@ int realpath_main(int argc UNUSED_PARAM, char **argv) { int retval = EXIT_SUCCESS; -#if PATH_MAX > (BUFSIZ+1) - RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX); -# define resolved_path_MUST_FREE 1 -#else -#define resolved_path bb_common_bufsiz1 -# define resolved_path_MUST_FREE 0 -#endif - if (!*++argv) { bb_show_usage(); } do { - if (realpath(*argv, resolved_path) != NULL) { + char *resolved_path = xmalloc_realpath(*argv); + if (resolved_path != NULL) { puts(resolved_path); + free(resolved_path); } else { retval = EXIT_FAILURE; bb_simple_perror_msg(*argv); } } while (*++argv); -#if ENABLE_FEATURE_CLEAN_UP && resolved_path_MUST_FREE - RELEASE_CONFIG_BUFFER(resolved_path); -#endif - fflush_stdout_and_exit(retval); } -- cgit v1.2.3