diff options
| author | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-04-30 18:17:00 +0000 |
|---|---|---|
| committer | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-04-30 18:17:00 +0000 |
| commit | db1ea6ee76a5106c45398bdc17c2db04da99ecf7 (patch) | |
| tree | a90a2bc3c3815f7f0e70f009b9b175736902a848 /applets | |
| parent | c9a51e8d05d64580a0f9ccce5b77c5b4ad990541 (diff) | |
| download | busybox-w32-db1ea6ee76a5106c45398bdc17c2db04da99ecf7.tar.gz busybox-w32-db1ea6ee76a5106c45398bdc17c2db04da99ecf7.tar.bz2 busybox-w32-db1ea6ee76a5106c45398bdc17c2db04da99ecf7.zip | |
Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
git-svn-id: svn://busybox.net/trunk/busybox@2495 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'applets')
| -rw-r--r-- | applets/busybox.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index b4939e19d..badd53d79 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
| @@ -37,21 +37,10 @@ typedef int (*__link_f)(const char *, const char *); | |||
| 37 | */ | 37 | */ |
| 38 | static char *busybox_fullpath() | 38 | static char *busybox_fullpath() |
| 39 | { | 39 | { |
| 40 | pid_t pid; | ||
| 41 | char path[256]; | ||
| 42 | char proc[256]; | 40 | char proc[256]; |
| 43 | int len; | 41 | |
| 44 | 42 | sprintf(proc, "/proc/%d/exe", getpid()); | |
| 45 | pid = getpid(); | 43 | return xreadlink(proc); |
| 46 | sprintf(proc, "/proc/%d/exe", pid); | ||
| 47 | len = readlink(proc, path, 256); | ||
| 48 | if (len != -1) { | ||
| 49 | path[len] = 0; | ||
| 50 | } else { | ||
| 51 | perror_msg("%s", proc); | ||
| 52 | return NULL; | ||
| 53 | } | ||
| 54 | return strdup(path); | ||
| 55 | } | 44 | } |
| 56 | 45 | ||
| 57 | /* create (sym)links for each applet */ | 46 | /* create (sym)links for each applet */ |
