syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
This commit is contained in:
@@ -664,7 +664,7 @@ static int list_single(struct dnode *dn)
|
||||
break;
|
||||
case LIST_SYMLINK:
|
||||
if (S_ISLNK(dn->dstat.st_mode)) {
|
||||
char *lpath = xreadlink(dn->fullname);
|
||||
char *lpath = xmalloc_readlink_or_warn(dn->fullname);
|
||||
if (!lpath) break;
|
||||
printf(" -> ");
|
||||
#if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR
|
||||
|
@@ -16,7 +16,8 @@ int pwd_main(int argc, char **argv)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
if ((buf = xgetcwd(NULL)) != NULL) {
|
||||
buf = xrealloc_getcwd_or_warn(NULL);
|
||||
if (buf != NULL) {
|
||||
puts(buf);
|
||||
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@@ -188,7 +188,7 @@ static void print_stat(char *pformat, size_t buf_len, char m,
|
||||
case 'N':
|
||||
strncat(pformat, "s", buf_len);
|
||||
if (S_ISLNK(statbuf->st_mode)) {
|
||||
char *linkname = xreadlink(filename);
|
||||
char *linkname = xmalloc_readlink_or_warn(filename);
|
||||
if (linkname == NULL) {
|
||||
bb_perror_msg("cannot read symbolic link '%s'", filename);
|
||||
return;
|
||||
@@ -477,7 +477,7 @@ static int do_stat(char const *filename, char const *format)
|
||||
pw_ent = getpwuid(statbuf.st_uid);
|
||||
|
||||
if (S_ISLNK(statbuf.st_mode))
|
||||
linkname = xreadlink(filename);
|
||||
linkname = xmalloc_readlink_or_warn(filename);
|
||||
if (linkname)
|
||||
printf(" File: \"%s\" -> \"%s\"\n", filename, linkname);
|
||||
else
|
||||
|
Reference in New Issue
Block a user