aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-09 13:04:50 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-09 13:04:50 +0000
commit7e754f12d304704d44e10fd4d2fdb8710526656e (patch)
tree9aa16703d48b9a7a38ccaec3759a19e95e976383 /libbb
parent2dfdd44d9d6c3984501683bbac2e78b18eeae1e7 (diff)
downloadbusybox-w32-7e754f12d304704d44e10fd4d2fdb8710526656e.tar.gz
busybox-w32-7e754f12d304704d44e10fd4d2fdb8710526656e.tar.bz2
busybox-w32-7e754f12d304704d44e10fd4d2fdb8710526656e.zip
Implement first instance of NOFORK applet - echo
find: use NOFORK/NOEXEC; small -exec buglet also eliminated vfork_daemon_rexec: honor PREFER_APPLETS echo: small size improvements find -exec echo {} \; with PREFER_APPLETS=y runs 4 times faster
Diffstat (limited to 'libbb')
-rw-r--r--libbb/process_escape_sequence.c9
-rw-r--r--libbb/vfork_daemon_rexec.c8
2 files changed, 8 insertions, 9 deletions
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c
index 138e751f5..3178ad34a 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -8,9 +8,6 @@
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9 */ 9 */
10 10
11#include <stdio.h>
12#include <limits.h>
13#include <ctype.h>
14#include "libbb.h" 11#include "libbb.h"
15 12
16#define WANT_HEX_ESCAPES 1 13#define WANT_HEX_ESCAPES 1
@@ -46,10 +43,10 @@ char bb_process_escape_sequence(const char **ptr)
46#endif 43#endif
47 44
48 do { 45 do {
49 d = (unsigned int)(*q - '0'); 46 d = (unsigned char)(*q) - '0';
50#ifdef WANT_HEX_ESCAPES 47#ifdef WANT_HEX_ESCAPES
51 if (d >= 10) { 48 if (d >= 10) {
52 d = ((unsigned int)(_tolower(*q) - 'a')) + 10; 49 d = (unsigned char)(_tolower(*q)) - 'a' + 10;
53 } 50 }
54#endif 51#endif
55 52
@@ -80,7 +77,7 @@ char bb_process_escape_sequence(const char **ptr)
80 break; 77 break;
81 } 78 }
82 } while (*++p); 79 } while (*++p);
83 n = *(p+(sizeof(charmap)/2)); 80 n = *(p + (sizeof(charmap)/2));
84 } 81 }
85 82
86 *ptr = q; 83 *ptr = q;
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index ec8b9b1d7..11dbb24fc 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -26,14 +26,16 @@ pid_t spawn(char **argv)
26 volatile int failed; 26 volatile int failed;
27 pid_t pid; 27 pid_t pid;
28 28
29 // Be nice to nommu machines. 29// Ain't it a good place to fflush(NULL)?
30
31 /* Be nice to nommu machines. */
30 failed = 0; 32 failed = 0;
31 pid = vfork(); 33 pid = vfork();
32 if (pid < 0) /* error */ 34 if (pid < 0) /* error */
33 return pid; 35 return pid;
34 if (!pid) { /* child */ 36 if (!pid) { /* child */
35 /* Don't use BB_EXECVP tricks here! */ 37 /* This macro is ok - it doesn't do NOEXEC/NOFORK tricks */
36 execvp(argv[0], argv); 38 BB_EXECVP(argv[0], argv);
37 39
38 /* We are (maybe) sharing a stack with blocked parent, 40 /* We are (maybe) sharing a stack with blocked parent,
39 * let parent know we failed and then exit to unblock parent 41 * let parent know we failed and then exit to unblock parent