aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorJérémie Koenig <jk@jk.fr.eu.org>2010-03-26 19:08:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-26 19:08:53 +0100
commitfbedacfc8caa1ec8f14e664a881cb0a93c8f8712 (patch)
tree6c08780bbaad6320149930bdbcfbee5a2eed9f5d /coreutils
parent35fdb1bc9cb82fa5630c2d40ae49110ecd7c88ea (diff)
downloadbusybox-w32-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.gz
busybox-w32-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.bz2
busybox-w32-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.zip
Hurd compat fixes. Mostly dealing with absent PATH_MAX
Signed-off-by: Jérémie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/realpath.c16
1 files changed, 3 insertions, 13 deletions
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)
17{ 17{
18 int retval = EXIT_SUCCESS; 18 int retval = EXIT_SUCCESS;
19 19
20#if PATH_MAX > (BUFSIZ+1)
21 RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX);
22# define resolved_path_MUST_FREE 1
23#else
24#define resolved_path bb_common_bufsiz1
25# define resolved_path_MUST_FREE 0
26#endif
27
28 if (!*++argv) { 20 if (!*++argv) {
29 bb_show_usage(); 21 bb_show_usage();
30 } 22 }
31 23
32 do { 24 do {
33 if (realpath(*argv, resolved_path) != NULL) { 25 char *resolved_path = xmalloc_realpath(*argv);
26 if (resolved_path != NULL) {
34 puts(resolved_path); 27 puts(resolved_path);
28 free(resolved_path);
35 } else { 29 } else {
36 retval = EXIT_FAILURE; 30 retval = EXIT_FAILURE;
37 bb_simple_perror_msg(*argv); 31 bb_simple_perror_msg(*argv);
38 } 32 }
39 } while (*++argv); 33 } while (*++argv);
40 34
41#if ENABLE_FEATURE_CLEAN_UP && resolved_path_MUST_FREE
42 RELEASE_CONFIG_BUFFER(resolved_path);
43#endif
44
45 fflush_stdout_and_exit(retval); 35 fflush_stdout_and_exit(retval);
46} 36}