diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-11 16:19:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-11 16:19:28 +0000 |
commit | 6ca0444420223c224162674902d4f6e4e093962d (patch) | |
tree | c13da1537be3327e041fac86d9fdce68de70298a /libbb | |
parent | 136f42f503cb3e9588e62332d043e92b7475ec4e (diff) | |
download | busybox-w32-6ca0444420223c224162674902d4f6e4e093962d.tar.gz busybox-w32-6ca0444420223c224162674902d4f6e4e093962d.tar.bz2 busybox-w32-6ca0444420223c224162674902d4f6e4e093962d.zip |
syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/copy_file.c | 2 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 | ||||
-rw-r--r-- | libbb/simplify_path.c | 2 | ||||
-rw-r--r-- | libbb/xgetcwd.c | 4 | ||||
-rw-r--r-- | libbb/xreadlink.c | 2 |
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) | |||
233 | } else if (S_ISLNK(source_stat.st_mode)) { | 233 | } else if (S_ISLNK(source_stat.st_mode)) { |
234 | char *lpath; | 234 | char *lpath; |
235 | 235 | ||
236 | lpath = xreadlink(source); | 236 | lpath = xmalloc_readlink_or_warn(source); |
237 | if (symlink(lpath, dest) < 0) { | 237 | if (symlink(lpath, dest) < 0) { |
238 | bb_perror_msg("cannot create symlink '%s'", dest); | 238 | bb_perror_msg("cannot create symlink '%s'", dest); |
239 | free(lpath); | 239 | 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) | |||
1090 | size_t cur_prmt_len = 0; | 1090 | size_t cur_prmt_len = 0; |
1091 | char flg_not_length = '['; | 1091 | char flg_not_length = '['; |
1092 | char *prmt_mem_ptr = xzalloc(1); | 1092 | char *prmt_mem_ptr = xzalloc(1); |
1093 | char *pwd_buf = xgetcwd(0); | 1093 | char *pwd_buf = xrealloc_getcwd_or_warn(NULL); |
1094 | char buf2[PATH_MAX + 1]; | 1094 | char buf2[PATH_MAX + 1]; |
1095 | char buf[2]; | 1095 | char buf[2]; |
1096 | char c; | 1096 | 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) | |||
16 | if (path[0] == '/') | 16 | if (path[0] == '/') |
17 | start = xstrdup(path); | 17 | start = xstrdup(path); |
18 | else { | 18 | else { |
19 | s = xgetcwd(NULL); | 19 | s = xrealloc_getcwd_or_warn(NULL); |
20 | start = concat_path_file(s, path); | 20 | start = concat_path_file(s, path); |
21 | free(s); | 21 | free(s); |
22 | } | 22 | } |
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 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | char * | 20 | char * |
21 | xgetcwd(char *cwd) | 21 | xrealloc_getcwd_or_warn(char *cwd) |
22 | { | 22 | { |
23 | char *ret; | 23 | char *ret; |
24 | unsigned path_max; | 24 | unsigned path_max; |
@@ -26,7 +26,7 @@ xgetcwd(char *cwd) | |||
26 | path_max = (unsigned) PATH_MAX; | 26 | path_max = (unsigned) PATH_MAX; |
27 | path_max += 2; /* The getcwd docs say to do this. */ | 27 | path_max += 2; /* The getcwd docs say to do this. */ |
28 | 28 | ||
29 | if (cwd==0) | 29 | if (cwd == NULL) |
30 | cwd = xmalloc(path_max); | 30 | cwd = xmalloc(path_max); |
31 | 31 | ||
32 | while ((ret = getcwd(cwd, path_max)) == NULL && errno == ERANGE) { | 32 | 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 @@ | |||
11 | * yourself. You have been warned. | 11 | * yourself. You have been warned. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | char *xreadlink(const char *path) | 14 | char *xmalloc_readlink_or_warn(const char *path) |
15 | { | 15 | { |
16 | enum { GROWBY = 80 }; /* how large we will grow strings by */ | 16 | enum { GROWBY = 80 }; /* how large we will grow strings by */ |
17 | 17 | ||