diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-02-11 16:19:28 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-02-11 16:19:28 +0000 |
commit | 661a976a4fe1564096942a548031bcc1a4915057 (patch) | |
tree | c13da1537be3327e041fac86d9fdce68de70298a /coreutils | |
parent | 5614b1d6f3e1a5c137f431999fbbb38ce8cb8db8 (diff) | |
download | busybox-w32-661a976a4fe1564096942a548031bcc1a4915057.tar.gz busybox-w32-661a976a4fe1564096942a548031bcc1a4915057.tar.bz2 busybox-w32-661a976a4fe1564096942a548031bcc1a4915057.zip |
syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
git-svn-id: svn://busybox.net/trunk/busybox@17854 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 2 | ||||
-rw-r--r-- | coreutils/pwd.c | 3 | ||||
-rw-r--r-- | coreutils/stat.c | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 798bc8201..34fae5026 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -664,7 +664,7 @@ static int list_single(struct dnode *dn) | |||
664 | break; | 664 | break; |
665 | case LIST_SYMLINK: | 665 | case LIST_SYMLINK: |
666 | if (S_ISLNK(dn->dstat.st_mode)) { | 666 | if (S_ISLNK(dn->dstat.st_mode)) { |
667 | char *lpath = xreadlink(dn->fullname); | 667 | char *lpath = xmalloc_readlink_or_warn(dn->fullname); |
668 | if (!lpath) break; | 668 | if (!lpath) break; |
669 | printf(" -> "); | 669 | printf(" -> "); |
670 | #if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR | 670 | #if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR |
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index b4599b4f3..d96f6a8e5 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -16,7 +16,8 @@ int pwd_main(int argc, char **argv) | |||
16 | { | 16 | { |
17 | char *buf; | 17 | char *buf; |
18 | 18 | ||
19 | if ((buf = xgetcwd(NULL)) != NULL) { | 19 | buf = xrealloc_getcwd_or_warn(NULL); |
20 | if (buf != NULL) { | ||
20 | puts(buf); | 21 | puts(buf); |
21 | fflush_stdout_and_exit(EXIT_SUCCESS); | 22 | fflush_stdout_and_exit(EXIT_SUCCESS); |
22 | } | 23 | } |
diff --git a/coreutils/stat.c b/coreutils/stat.c index ff14a1599..20ade9472 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -188,7 +188,7 @@ static void print_stat(char *pformat, size_t buf_len, char m, | |||
188 | case 'N': | 188 | case 'N': |
189 | strncat(pformat, "s", buf_len); | 189 | strncat(pformat, "s", buf_len); |
190 | if (S_ISLNK(statbuf->st_mode)) { | 190 | if (S_ISLNK(statbuf->st_mode)) { |
191 | char *linkname = xreadlink(filename); | 191 | char *linkname = xmalloc_readlink_or_warn(filename); |
192 | if (linkname == NULL) { | 192 | if (linkname == NULL) { |
193 | bb_perror_msg("cannot read symbolic link '%s'", filename); | 193 | bb_perror_msg("cannot read symbolic link '%s'", filename); |
194 | return; | 194 | return; |
@@ -477,7 +477,7 @@ static int do_stat(char const *filename, char const *format) | |||
477 | pw_ent = getpwuid(statbuf.st_uid); | 477 | pw_ent = getpwuid(statbuf.st_uid); |
478 | 478 | ||
479 | if (S_ISLNK(statbuf.st_mode)) | 479 | if (S_ISLNK(statbuf.st_mode)) |
480 | linkname = xreadlink(filename); | 480 | linkname = xmalloc_readlink_or_warn(filename); |
481 | if (linkname) | 481 | if (linkname) |
482 | printf(" File: \"%s\" -> \"%s\"\n", filename, linkname); | 482 | printf(" File: \"%s\" -> \"%s\"\n", filename, linkname); |
483 | else | 483 | else |