From 8a633268ef478a31bd649d582ce07e9c26a4a03a Mon Sep 17 00:00:00 2001 From: Mark Whitley Date: Mon, 30 Apr 2001 18:17:00 +0000 Subject: Made new xreadlink function for libbb and changed applets to use it instead of readlink(2). --- applets/busybox.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'applets') 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 *); */ 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 */ -- cgit v1.2.3