summaryrefslogtreecommitdiff
path: root/busybox.c
diff options
context:
space:
mode:
authorMark Whitley2001-04-30 18:17:00 +0000
committerMark Whitley2001-04-30 18:17:00 +0000
commit8a633268ef478a31bd649d582ce07e9c26a4a03a (patch)
treea90a2bc3c3815f7f0e70f009b9b175736902a848 /busybox.c
parent6f343944548c2e41fde4a376e805bf322a8e01c9 (diff)
downloadbusybox-8a633268ef478a31bd649d582ce07e9c26a4a03a.zip
busybox-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.gz
Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
Diffstat (limited to 'busybox.c')
-rw-r--r--busybox.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/busybox.c b/busybox.c
index b4939e1..badd53d 100644
--- a/busybox.c
+++ b/busybox.c
@@ -37,21 +37,10 @@ typedef int (*__link_f)(const char *, const char *);
*/
static char *busybox_fullpath()
{
- pid_t pid;
- char path[256];
char proc[256];
- int len;
-
- pid = getpid();
- sprintf(proc, "/proc/%d/exe", pid);
- len = readlink(proc, path, 256);
- if (len != -1) {
- path[len] = 0;
- } else {
- perror_msg("%s", proc);
- return NULL;
- }
- return strdup(path);
+
+ sprintf(proc, "/proc/%d/exe", getpid());
+ return xreadlink(proc);
}
/* create (sym)links for each applet */