aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/busybox.c41
-rw-r--r--busybox.c41
2 files changed, 40 insertions, 42 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 2a686041a..48ca05408 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -361,16 +361,15 @@ const struct BB_applet applets[] = {
361#ifdef BB_FEATURE_INSTALLER 361#ifdef BB_FEATURE_INSTALLER
362/* 362/*
363 * directory table 363 * directory table
364 * this should be consistent w/ the enum, internal.h::Location, 364 * this should be consistent w/ the enum, internal.h::Location,
365 * or else... 365 * or else...
366 */ 366 */
367static char* install_dir[] = { 367static char* install_dir[] = {
368 "/", 368 "/",
369 "/bin", 369 "/bin",
370 "/sbin", 370 "/sbin",
371 "/usr/bin", 371 "/usr/bin",
372 "/usr/sbin", 372 "/usr/sbin",
373 NULL
374}; 373};
375 374
376/* abstract link() */ 375/* abstract link() */
@@ -384,10 +383,10 @@ typedef int (*__link_f)(const char *, const char *);
384 */ 383 */
385static char *busybox_fullpath() 384static char *busybox_fullpath()
386{ 385{
387 pid_t pid; 386 pid_t pid;
388 char path[256]; 387 char path[256];
389 char proc[256]; 388 char proc[256];
390 int len; 389 int len;
391 390
392 pid = getpid(); 391 pid = getpid();
393 sprintf(proc, "/proc/%d/exe", pid); 392 sprintf(proc, "/proc/%d/exe", pid);
@@ -404,30 +403,30 @@ static char *busybox_fullpath()
404/* create (sym)links for each applet */ 403/* create (sym)links for each applet */
405static int install_links(const char *busybox, int use_symbolic_links) 404static int install_links(const char *busybox, int use_symbolic_links)
406{ 405{
407 __link_f Link = link; 406 __link_f Link = link;
408 407
409 char command[256]; 408 char command[256];
410 int i; 409 int i;
411 int rc = 0; 410 int rc = 0;
412 411
413 if (use_symbolic_links) Link = symlink; 412 if (use_symbolic_links) Link = symlink;
414 413
415 for (i = 0; applets[i].name != NULL; i++) { 414 for (i = 0; applets[i].name != NULL; i++) {
416 sprintf ( 415 sprintf (
417 command, 416 command,
418 "%s/%s", 417 "%s/%s",
419 install_dir[applets[i].location], 418 install_dir[applets[i].location],
420 applets[i].name 419 applets[i].name
421 ); 420 );
422#if 1 421#if 1
423 rc |= Link(busybox, command); 422 rc |= Link(busybox, command);
424#else 423#else
425 puts(command); 424 puts(command);
426#endif 425#endif
427 if (rc) { 426 if (rc) {
428 fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno)); 427 fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno));
429 } 428 }
430 } 429 }
431 return rc; 430 return rc;
432} 431}
433 432
diff --git a/busybox.c b/busybox.c
index 2a686041a..48ca05408 100644
--- a/busybox.c
+++ b/busybox.c
@@ -361,16 +361,15 @@ const struct BB_applet applets[] = {
361#ifdef BB_FEATURE_INSTALLER 361#ifdef BB_FEATURE_INSTALLER
362/* 362/*
363 * directory table 363 * directory table
364 * this should be consistent w/ the enum, internal.h::Location, 364 * this should be consistent w/ the enum, internal.h::Location,
365 * or else... 365 * or else...
366 */ 366 */
367static char* install_dir[] = { 367static char* install_dir[] = {
368 "/", 368 "/",
369 "/bin", 369 "/bin",
370 "/sbin", 370 "/sbin",
371 "/usr/bin", 371 "/usr/bin",
372 "/usr/sbin", 372 "/usr/sbin",
373 NULL
374}; 373};
375 374
376/* abstract link() */ 375/* abstract link() */
@@ -384,10 +383,10 @@ typedef int (*__link_f)(const char *, const char *);
384 */ 383 */
385static char *busybox_fullpath() 384static char *busybox_fullpath()
386{ 385{
387 pid_t pid; 386 pid_t pid;
388 char path[256]; 387 char path[256];
389 char proc[256]; 388 char proc[256];
390 int len; 389 int len;
391 390
392 pid = getpid(); 391 pid = getpid();
393 sprintf(proc, "/proc/%d/exe", pid); 392 sprintf(proc, "/proc/%d/exe", pid);
@@ -404,30 +403,30 @@ static char *busybox_fullpath()
404/* create (sym)links for each applet */ 403/* create (sym)links for each applet */
405static int install_links(const char *busybox, int use_symbolic_links) 404static int install_links(const char *busybox, int use_symbolic_links)
406{ 405{
407 __link_f Link = link; 406 __link_f Link = link;
408 407
409 char command[256]; 408 char command[256];
410 int i; 409 int i;
411 int rc = 0; 410 int rc = 0;
412 411
413 if (use_symbolic_links) Link = symlink; 412 if (use_symbolic_links) Link = symlink;
414 413
415 for (i = 0; applets[i].name != NULL; i++) { 414 for (i = 0; applets[i].name != NULL; i++) {
416 sprintf ( 415 sprintf (
417 command, 416 command,
418 "%s/%s", 417 "%s/%s",
419 install_dir[applets[i].location], 418 install_dir[applets[i].location],
420 applets[i].name 419 applets[i].name
421 ); 420 );
422#if 1 421#if 1
423 rc |= Link(busybox, command); 422 rc |= Link(busybox, command);
424#else 423#else
425 puts(command); 424 puts(command);
426#endif 425#endif
427 if (rc) { 426 if (rc) {
428 fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno)); 427 fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno));
429 } 428 }
430 } 429 }
431 return rc; 430 return rc;
432} 431}
433 432