aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/xreadlink.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index a4e402b84..a18dd0748 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -148,10 +148,10 @@ char* FAST_FUNC xmalloc_realpath_coreutils(const char *path)
148 strcpy(buf + len, last_slash); 148 strcpy(buf + len, last_slash);
149 } 149 }
150 } else { 150 } else {
151 char *link = xmalloc_readlink(path); 151 char *target = xmalloc_readlink(path);
152 if (link) { 152 if (target) {
153 char *cwd; 153 char *cwd;
154 if (link[0] == '/') { 154 if (target[0] == '/') {
155 /* 155 /*
156 * $ ln -s /bin/qwe symlink # note: /bin is a link to /usr/bin 156 * $ ln -s /bin/qwe symlink # note: /bin is a link to /usr/bin
157 * $ readlink -f symlink 157 * $ readlink -f symlink
@@ -159,8 +159,8 @@ char* FAST_FUNC xmalloc_realpath_coreutils(const char *path)
159 * $ realpath symlink 159 * $ realpath symlink
160 * /usr/bin/qwe/target_does_not_exist 160 * /usr/bin/qwe/target_does_not_exist
161 */ 161 */
162 buf = xmalloc_realpath_coreutils(link); 162 buf = xmalloc_realpath_coreutils(target);
163 free(link); 163 free(target);
164 return buf; 164 return buf;
165 } 165 }
166 /* 166 /*
@@ -171,9 +171,9 @@ char* FAST_FUNC xmalloc_realpath_coreutils(const char *path)
171 * /CURDIR/target_does_not_exist 171 * /CURDIR/target_does_not_exist
172 */ 172 */
173 cwd = xrealloc_getcwd_or_warn(NULL); 173 cwd = xrealloc_getcwd_or_warn(NULL);
174 buf = concat_path_file(cwd, link); 174 buf = concat_path_file(cwd, target);
175 free(cwd); 175 free(cwd);
176 free(link); 176 free(target);
177 return buf; 177 return buf;
178 } 178 }
179 } 179 }