diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-04 17:59:59 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-04 17:59:59 +0000 |
| commit | a9b60e93eeb4d2706ebc95bafb18bd4267a03d6f (patch) | |
| tree | 541b0130abde25c96918f4c0176514c3b29baa9f /libbb | |
| parent | ceab8700dfa0a4f987c9872e12e57cfba6ddb95c (diff) | |
| download | busybox-w32-a9b60e93eeb4d2706ebc95bafb18bd4267a03d6f.tar.gz busybox-w32-a9b60e93eeb4d2706ebc95bafb18bd4267a03d6f.tar.bz2 busybox-w32-a9b60e93eeb4d2706ebc95bafb18bd4267a03d6f.zip | |
new libbb func: xmalloc_realpath (+ use it where makes sense)
syslogd, logread: add debugging code (disabled)
syslogs: drastically smaller bss; fix "-C n" behaviour
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/xreadlink.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 14863d9d5..76f52ca06 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c | |||
| @@ -4,16 +4,13 @@ | |||
| 4 | * Returns a NULL on failure... | 4 | * Returns a NULL on failure... |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <stdio.h> | 7 | #include "libbb.h" |
| 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. You have been warned. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <unistd.h> | ||
| 15 | #include "libbb.h" | ||
| 16 | |||
| 17 | char *xreadlink(const char *path) | 14 | char *xreadlink(const char *path) |
| 18 | { | 15 | { |
| 19 | enum { GROWBY = 80 }; /* how large we will grow strings by */ | 16 | enum { GROWBY = 80 }; /* how large we will grow strings by */ |
| @@ -36,3 +33,16 @@ char *xreadlink(const char *path) | |||
| 36 | 33 | ||
| 37 | return buf; | 34 | return buf; |
| 38 | } | 35 | } |
| 36 | |||
| 37 | char *xmalloc_realpath(const char *path) | ||
| 38 | { | ||
| 39 | #ifdef __GLIBC__ | ||
| 40 | /* glibc provides a non-standard extension */ | ||
| 41 | return realpath(path, NULL); | ||
| 42 | #else | ||
| 43 | char buf[PATH_MAX+1]; | ||
| 44 | |||
| 45 | /* on error returns NULL (xstrdup(NULL) ==NULL) */ | ||
| 46 | return xstrdup(realpath(path, buf)); | ||
| 47 | #endif | ||
| 48 | } | ||
