diff options
Diffstat (limited to 'findutils/find.c')
-rw-r--r-- | findutils/find.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/findutils/find.c b/findutils/find.c index 1e15e8899..aa915fa0f 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -11,14 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "busybox.h" | 13 | #include "busybox.h" |
14 | #include <stdio.h> | ||
15 | #include <unistd.h> | ||
16 | #include <dirent.h> | ||
17 | #include <string.h> | ||
18 | #include <stdlib.h> | ||
19 | #include <fnmatch.h> | 14 | #include <fnmatch.h> |
20 | #include <time.h> | ||
21 | #include <ctype.h> | ||
22 | 15 | ||
23 | static char *pattern; | 16 | static char *pattern; |
24 | #ifdef CONFIG_FEATURE_FIND_PRINT0 | 17 | #ifdef CONFIG_FEATURE_FIND_PRINT0 |
@@ -138,8 +131,8 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | |||
138 | int i; | 131 | int i; |
139 | char *cmd_string = ""; | 132 | char *cmd_string = ""; |
140 | for (i = 0; i < num_matches; i++) | 133 | for (i = 0; i < num_matches; i++) |
141 | cmd_string = bb_xasprintf("%s%s%s", cmd_string, exec_str[i], fileName); | 134 | cmd_string = xasprintf("%s%s%s", cmd_string, exec_str[i], fileName); |
142 | cmd_string = bb_xasprintf("%s%s", cmd_string, exec_str[num_matches]); | 135 | cmd_string = xasprintf("%s%s", cmd_string, exec_str[num_matches]); |
143 | system(cmd_string); | 136 | system(cmd_string); |
144 | goto no_match; | 137 | goto no_match; |
145 | } | 138 | } |
@@ -300,7 +293,7 @@ int find_main(int argc, char **argv) | |||
300 | bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); | 293 | bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); |
301 | if (*argv[i] == ';') | 294 | if (*argv[i] == ';') |
302 | break; | 295 | break; |
303 | cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); | 296 | cmd_string = xasprintf("%s %s", cmd_string, argv[i]); |
304 | } | 297 | } |
305 | 298 | ||
306 | if (*cmd_string == 0) | 299 | if (*cmd_string == 0) |
@@ -311,10 +304,10 @@ int find_main(int argc, char **argv) | |||
311 | while ((b_pos = strstr(cmd_string, "{}") - cmd_string), (b_pos >= 0)) { | 304 | while ((b_pos = strstr(cmd_string, "{}") - cmd_string), (b_pos >= 0)) { |
312 | num_matches++; | 305 | num_matches++; |
313 | exec_str = xrealloc(exec_str, (num_matches + 1) * sizeof(char *)); | 306 | exec_str = xrealloc(exec_str, (num_matches + 1) * sizeof(char *)); |
314 | exec_str[num_matches - 1] = bb_xstrndup(cmd_string, b_pos); | 307 | exec_str[num_matches - 1] = xstrndup(cmd_string, b_pos); |
315 | cmd_string += b_pos + 2; | 308 | cmd_string += b_pos + 2; |
316 | } | 309 | } |
317 | exec_str[num_matches] = bb_xstrdup(cmd_string); | 310 | exec_str[num_matches] = xstrdup(cmd_string); |
318 | exec_opt = 1; | 311 | exec_opt = 1; |
319 | #endif | 312 | #endif |
320 | } else | 313 | } else |