diff options
author | Mark Whitley <markw@lineo.com> | 2001-04-30 18:17:00 +0000 |
---|---|---|
committer | Mark Whitley <markw@lineo.com> | 2001-04-30 18:17:00 +0000 |
commit | 8a633268ef478a31bd649d582ce07e9c26a4a03a (patch) | |
tree | a90a2bc3c3815f7f0e70f009b9b175736902a848 /applets | |
parent | 6f343944548c2e41fde4a376e805bf322a8e01c9 (diff) | |
download | busybox-w32-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.gz busybox-w32-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.bz2 busybox-w32-8a633268ef478a31bd649d582ce07e9c26a4a03a.zip |
Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
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 */ |