libbb: deal with "declaration of 'link' shadows a global declaration" warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
3a0eea0887
commit
25a871fb40
@ -148,10 +148,10 @@ char* FAST_FUNC xmalloc_realpath_coreutils(const char *path)
|
|||||||
strcpy(buf + len, last_slash);
|
strcpy(buf + len, last_slash);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *link = xmalloc_readlink(path);
|
char *target = xmalloc_readlink(path);
|
||||||
if (link) {
|
if (target) {
|
||||||
char *cwd;
|
char *cwd;
|
||||||
if (link[0] == '/') {
|
if (target[0] == '/') {
|
||||||
/*
|
/*
|
||||||
* $ ln -s /bin/qwe symlink # note: /bin is a link to /usr/bin
|
* $ ln -s /bin/qwe symlink # note: /bin is a link to /usr/bin
|
||||||
* $ readlink -f symlink
|
* $ readlink -f symlink
|
||||||
@ -159,8 +159,8 @@ char* FAST_FUNC xmalloc_realpath_coreutils(const char *path)
|
|||||||
* $ realpath symlink
|
* $ realpath symlink
|
||||||
* /usr/bin/qwe/target_does_not_exist
|
* /usr/bin/qwe/target_does_not_exist
|
||||||
*/
|
*/
|
||||||
buf = xmalloc_realpath_coreutils(link);
|
buf = xmalloc_realpath_coreutils(target);
|
||||||
free(link);
|
free(target);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -171,9 +171,9 @@ char* FAST_FUNC xmalloc_realpath_coreutils(const char *path)
|
|||||||
* /CURDIR/target_does_not_exist
|
* /CURDIR/target_does_not_exist
|
||||||
*/
|
*/
|
||||||
cwd = xrealloc_getcwd_or_warn(NULL);
|
cwd = xrealloc_getcwd_or_warn(NULL);
|
||||||
buf = concat_path_file(cwd, link);
|
buf = concat_path_file(cwd, target);
|
||||||
free(cwd);
|
free(cwd);
|
||||||
free(link);
|
free(target);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user