aboutsummaryrefslogtreecommitdiffstats
path: root/package/busybox/patches/190-ash_performance.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-10-13 22:51:49 +0200
committerFelix Fietkau <nbd@openwrt.org>2016-03-20 17:29:15 +0100
commit60c1f0f64d23003a19a07d6b9638542130f6641d (patch)
tree8fb2787f4c49baded97cd55e0c371fe1cffce2b6 /package/busybox/patches/190-ash_performance.patch
parentd58a09110ccfa95f06c983fe796806f2e035c9d2 (diff)
parentb3ce218b51746d3a576221ea542facf3a1703ab2 (diff)
downloadupstream-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.gz
upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.bz2
upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.zip
finally move buildroot-ng to trunk
Diffstat (limited to 'package/busybox/patches/190-ash_performance.patch')
-rw-r--r--package/busybox/patches/190-ash_performance.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/package/busybox/patches/190-ash_performance.patch b/package/busybox/patches/190-ash_performance.patch
new file mode 100644
index 0000000000..0931931419
--- /dev/null
+++ b/package/busybox/patches/190-ash_performance.patch
@@ -0,0 +1,80 @@
+
+ Copyright (C) 2006 OpenWrt.org
+
+diff -urN busybox.old/shell/ash.c busybox.dev/shell/ash.c
+--- busybox.old/shell/ash.c 2005-11-12 22:39:19.853826250 +0100
++++ busybox.dev/shell/ash.c 2005-11-12 22:39:42.771258500 +0100
+@@ -1414,6 +1414,13 @@
+
+ #define NUMBUILTINS (sizeof (builtincmd) / sizeof (struct builtincmd) )
+
++static const char *safe_applets[] = {
++ "[", "test", "echo", "cat",
++ "ln", "cp", "touch", "mkdir", "rm",
++ "cut", "hexdump", "awk", "sort",
++ "find", "xargs", "ls", "dd",
++ "chown", "chmod"
++};
+
+
+ struct cmdentry {
+@@ -2050,6 +2057,19 @@
+ static void exitshell(void) __attribute__((__noreturn__));
+ static int decode_signal(const char *, int);
+
++
++static int is_safe_applet(char *name)
++{
++ int n = sizeof(safe_applets) / sizeof(char *);
++ int i;
++ for (i = 0; i < n; i++)
++ if (strcmp(safe_applets[i], name) == 0)
++ return 1;
++
++ return 0;
++}
++
++
+ /*
+ * This routine is called when an error or an interrupt occurs in an
+ * interactive shell and control is returned to the main command loop.
+@@ -3680,6 +3700,7 @@
+ clearredir(1);
+ envp = environment();
+ if (strchr(argv[0], '/') != NULL
++ || is_safe_applet(argv[0])
+ #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
+ || find_applet_by_name(argv[0])
+ #endif
+@@ -3721,6 +3742,18 @@
+ tryexec(char *cmd, char **argv, char **envp)
+ {
+ int repeated = 0;
++ struct BB_applet *a;
++ int argc = 0;
++ char **c;
++
++ if(strchr(cmd, '/') == NULL && is_safe_applet(cmd) && (a = find_applet_by_name(cmd)) != NULL) {
++ c = argv;
++ while (*c != NULL) {
++ c++; argc++;
++ }
++ bb_applet_name = cmd;
++ exit(a->main(argc, argv));
++ }
+ #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
+ int flg_bb = 0;
+ char *name = cmd;
+@@ -3919,6 +3952,12 @@
+ }
+ #endif
+
++ if (is_safe_applet(name)) {
++ entry->cmdtype = CMDNORMAL;
++ entry->u.index = -1;
++ return;
++ }
++
+ updatetbl = (path == pathval());
+ if (!updatetbl) {
+ act |= DO_ALTPATH;
n294' href='#n294'>294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453