diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-11-08 21:11:43 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-11-08 21:11:43 +0000 |
commit | 9bd8d0c23e867238bad53b04a029f71db9b88c3f (patch) | |
tree | d2373a9bd992d2c52cc21704f76d0815bbb178e2 | |
parent | 599bbfbd9be0073c262319a120174fad5a60113e (diff) | |
download | busybox-w32-9bd8d0c23e867238bad53b04a029f71db9b88c3f.tar.gz busybox-w32-9bd8d0c23e867238bad53b04a029f71db9b88c3f.tar.bz2 busybox-w32-9bd8d0c23e867238bad53b04a029f71db9b88c3f.zip |
- commentary fixes
- use common exit sequence for failure path:
text data bss dec hex filename
308 0 0 308 134 libbb/xreadlink.o.pgf
296 0 0 296 128 libbb/xreadlink.o
-rw-r--r-- | libbb/xreadlink.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index a5f7eb8be..0b6eb05f3 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | /* | 9 | /* |
10 | * NOTE: This function returns a malloced char* that you will have to free | 10 | * NOTE: This function returns a malloced char* that you will have to free |
11 | * yourself. You have been warned. | 11 | * yourself. |
12 | */ | 12 | */ |
13 | char *xmalloc_readlink(const char *path) | 13 | char *xmalloc_readlink(const char *path) |
14 | { | 14 | { |
@@ -33,14 +33,14 @@ char *xmalloc_readlink(const char *path) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * this routine is not the same as realpath(), which | 36 | * This routine is not the same as realpath(), which |
37 | * canonicalizes the given path completely. this routine only | 37 | * canonicalizes the given path completely. This routine only |
38 | * follows trailing symlinks until a real file is reached, and | 38 | * follows trailing symlinks until a real file is reached and |
39 | * returns its name. if the path ends in a dangling link, or if | 39 | * returns its name. If the path ends in a dangling link or if |
40 | * the target doesn't exist, the path is returned in any case. | 40 | * the target doesn't exist, the path is returned in any case. |
41 | * intermediate symlinks in the path are not expanded -- only | 41 | * Intermediate symlinks in the path are not expanded -- only |
42 | * those at the tail. | 42 | * those at the tail. |
43 | * a malloced char* is returned, which must be freed by the caller. | 43 | * A malloced char* is returned, which must be freed by the caller. |
44 | */ | 44 | */ |
45 | char *xmalloc_follow_symlinks(const char *path) | 45 | char *xmalloc_follow_symlinks(const char *path) |
46 | { | 46 | { |
@@ -60,12 +60,12 @@ char *xmalloc_follow_symlinks(const char *path) | |||
60 | /* not a symlink, or doesn't exist */ | 60 | /* not a symlink, or doesn't exist */ |
61 | if (errno == EINVAL || errno == ENOENT) | 61 | if (errno == EINVAL || errno == ENOENT) |
62 | return buf; | 62 | return buf; |
63 | free(buf); | 63 | goto free_buf_ret_null; |
64 | return NULL; | 64 | } |
65 | } | ||
66 | 65 | ||
67 | if (!--looping) { | 66 | if (!--looping) { |
68 | free(linkpath); | 67 | free(linkpath); |
68 | free_buf_ret_null: | ||
69 | free(buf); | 69 | free(buf); |
70 | return NULL; | 70 | return NULL; |
71 | } | 71 | } |