summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-05-19 10:57:02 +0000
committerBernhard Reutner-Fischer2006-05-19 10:57:02 +0000
commit1ee8b638cff70823f1648e050282db49bc23d0bd (patch)
treea36f54697664eb400a7ba2ce7426697751cd3c11
parent0c4b9fdda1cdc6b68f6cf531cb88f438228fcd3c (diff)
downloadbusybox-1ee8b638cff70823f1648e050282db49bc23d0bd.zip
busybox-1ee8b638cff70823f1648e050282db49bc23d0bd.tar.gz
The gnu extension to have realpath() malloc its buffer when handed a NULL
isn't implemented in uClibc, so we can't use it. (r15092 from trunk plus coding-style fix for the patch)
-rw-r--r--debianutils/readlink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/debianutils/readlink.c b/debianutils/readlink.c
index 83abdbf..8495ee5 100644
--- a/debianutils/readlink.c
+++ b/debianutils/readlink.c
@@ -25,7 +25,7 @@ int readlink_main(int argc, char **argv)
bb_show_usage();
if (opt & READLINK_FLAG_f)
- buf = realpath(argv[optind], NULL);
+ buf = realpath(argv[optind], bb_common_bufsiz1);
else
buf = xreadlink(argv[ENABLE_FEATURE_READLINK_FOLLOW ? optind : 1]);
@@ -33,7 +33,8 @@ int readlink_main(int argc, char **argv)
return EXIT_FAILURE;
puts(buf);
- if (ENABLE_FEATURE_CLEAN_UP) free(buf);
+ if (ENABLE_FEATURE_CLEAN_UP && buf != bb_common_bufsiz1)
+ free(buf);
return EXIT_SUCCESS;
}