aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-02-11 16:19:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-02-11 16:19:28 +0000
commit6ca0444420223c224162674902d4f6e4e093962d (patch)
treec13da1537be3327e041fac86d9fdce68de70298a /libbb
parent136f42f503cb3e9588e62332d043e92b7475ec4e (diff)
downloadbusybox-6ca0444420223c224162674902d4f6e4e093962d.tar.gz
syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copy_file.c2
-rw-r--r--libbb/lineedit.c2
-rw-r--r--libbb/simplify_path.c2
-rw-r--r--libbb/xgetcwd.c4
-rw-r--r--libbb/xreadlink.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 632064eaa..bd785b71c 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -233,7 +233,7 @@ int copy_file(const char *source, const char *dest, int flags)
} else if (S_ISLNK(source_stat.st_mode)) {
char *lpath;
- lpath = xreadlink(source);
+ lpath = xmalloc_readlink_or_warn(source);
if (symlink(lpath, dest) < 0) {
bb_perror_msg("cannot create symlink '%s'", dest);
free(lpath);
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 937d70d1f..16256f726 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1090,7 +1090,7 @@ static void parse_prompt(const char *prmt_ptr)
size_t cur_prmt_len = 0;
char flg_not_length = '[';
char *prmt_mem_ptr = xzalloc(1);
- char *pwd_buf = xgetcwd(0);
+ char *pwd_buf = xrealloc_getcwd_or_warn(NULL);
char buf2[PATH_MAX + 1];
char buf[2];
char c;
diff --git a/libbb/simplify_path.c b/libbb/simplify_path.c
index b714c66b6..7e68e3911 100644
--- a/libbb/simplify_path.c
+++ b/libbb/simplify_path.c
@@ -16,7 +16,7 @@ char *bb_simplify_path(const char *path)
if (path[0] == '/')
start = xstrdup(path);
else {
- s = xgetcwd(NULL);
+ s = xrealloc_getcwd_or_warn(NULL);
start = concat_path_file(s, path);
free(s);
}
diff --git a/libbb/xgetcwd.c b/libbb/xgetcwd.c
index 0ac450d3b..ec1d8f7a4 100644
--- a/libbb/xgetcwd.c
+++ b/libbb/xgetcwd.c
@@ -18,7 +18,7 @@
*/
char *
-xgetcwd(char *cwd)
+xrealloc_getcwd_or_warn(char *cwd)
{
char *ret;
unsigned path_max;
@@ -26,7 +26,7 @@ xgetcwd(char *cwd)
path_max = (unsigned) PATH_MAX;
path_max += 2; /* The getcwd docs say to do this. */
- if (cwd==0)
+ if (cwd == NULL)
cwd = xmalloc(path_max);
while ((ret = getcwd(cwd, path_max)) == NULL && errno == ERANGE) {
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index fb67cdef1..18a8b9467 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -11,7 +11,7 @@
* yourself. You have been warned.
*/
-char *xreadlink(const char *path)
+char *xmalloc_readlink_or_warn(const char *path)
{
enum { GROWBY = 80 }; /* how large we will grow strings by */