aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-28 22:04:04 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-28 22:04:04 +0000
commit45cd089df1d0f519f863baed46f8f3afd8b19593 (patch)
treed5c460e3ff40156b38b16f049b1ca6026787b1b7
parent450196c119e22268c9176cb7887cceb22bf8e9ff (diff)
downloadbusybox-w32-45cd089df1d0f519f863baed46f8f3afd8b19593.tar.gz
busybox-w32-45cd089df1d0f519f863baed46f8f3afd8b19593.tar.bz2
busybox-w32-45cd089df1d0f519f863baed46f8f3afd8b19593.zip
run_parts: NULL-terminate list of arguments; fix perror/error usage
-rw-r--r--debianutils/run_parts.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index aa449c410..7d41c6913 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -49,8 +49,8 @@ static const struct option runparts_long_options[] = {
49#endif 49#endif
50 50
51struct globals { 51struct globals {
52 char *cmd[10]; /* merely arbitrary arg count */
53 smalluint mode; 52 smalluint mode;
53 char *cmd[10]; /* merely arbitrary arg count */
54}; 54};
55#define G (*(struct globals*)&bb_common_bufsiz1) 55#define G (*(struct globals*)&bb_common_bufsiz1)
56 56
@@ -101,9 +101,9 @@ static int act(const char *file, struct stat *statbuf, void *args, int depth)
101 G.cmd[0] = (char*)file; 101 G.cmd[0] = (char*)file;
102 ret = wait4pid(spawn(G.cmd)); 102 ret = wait4pid(spawn(G.cmd));
103 if (ret < 0) { 103 if (ret < 0) {
104 bb_error_msg("failed to exec %s", *G.cmd); 104 bb_perror_msg("failed to exec %s", file);
105 } else if (ret > 0) { 105 } else if (ret > 0) {
106 bb_perror_msg("%s exited with return code %d", *G.cmd, ret); 106 bb_error_msg("%s exited with return code %d", file, ret);
107 } 107 }
108 return !ret; 108 return !ret;
109} 109}
@@ -129,14 +129,14 @@ int run_parts_main(int argc, char **argv)
129 * libc is not foolproof; it will take the 8 and 9 digits under 129 * libc is not foolproof; it will take the 8 and 9 digits under
130 * some circumstances. We'll just have to live with it. 130 * some circumstances. We'll just have to live with it.
131 */ 131 */
132 umask(xstrtoul_range(umask_p, 8, 0, 07777)); 132 umask(xstrtoul_range(umask_p, 8, 0, 07777));
133 } 133 }
134//XXX: FIXME: reverse the list before handing it over to the user. 134//XXX: FIXME: reverse the list before handing it over to the user.
135//XXX: FIXME: The common case seems to be to use the order given by the user 135//XXX: FIXME: The common case seems to be to use the order given by the user
136 arg_list = llist_rev(arg_list); /* XXX: getopt32 appends them */ 136 arg_list = llist_rev(arg_list); /* XXX: getopt32 appends them */
137 G.cmd[0] = (char*)"";
138 for (tmp = 1; arg_list; arg_list = arg_list->link, tmp++) 137 for (tmp = 1; arg_list; arg_list = arg_list->link, tmp++)
139 G.cmd[tmp] = arg_list->data; 138 G.cmd[tmp] = arg_list->data;
139 G.cmd[tmp] = NULL;
140 if (!recursive_action(argv[argc - 1], 140 if (!recursive_action(argv[argc - 1],
141 TRUE, /* recurse */ 141 TRUE, /* recurse */
142 TRUE, /* follow links */ 142 TRUE, /* follow links */