Made new xreadlink function for libbb and changed applets to use it instead of

readlink(2).
This commit is contained in:
Mark Whitley
2001-04-30 18:17:00 +00:00
parent 6f34394454
commit 8a633268ef
13 changed files with 75 additions and 88 deletions

View File

@@ -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 */