diff options
Diffstat (limited to '')
-rw-r--r-- | miscutils/crond.c | 12 | ||||
-rw-r--r-- | miscutils/fbsplash.c | 2 | ||||
-rw-r--r-- | miscutils/less.c | 2 | ||||
-rw-r--r-- | miscutils/make.c | 37 | ||||
-rw-r--r-- | miscutils/man.c | 2 |
5 files changed, 43 insertions, 12 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index b3762d327..6a384fdfb 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -177,7 +177,7 @@ static void crondlog(unsigned level, const char *msg, va_list va) | |||
177 | { | 177 | { |
178 | if (level >= G.log_level) { | 178 | if (level >= G.log_level) { |
179 | /* | 179 | /* |
180 | * We are called only for info meesages. | 180 | * We are called only for info messages. |
181 | * Warnings/errors use plain bb_[p]error_msg's, which | 181 | * Warnings/errors use plain bb_[p]error_msg's, which |
182 | * need not touch syslog_level | 182 | * need not touch syslog_level |
183 | * (they are ok with LOG_ERR default). | 183 | * (they are ok with LOG_ERR default). |
@@ -989,7 +989,7 @@ static int check_completions(void) | |||
989 | if (line->cl_pid <= 0) | 989 | if (line->cl_pid <= 0) |
990 | continue; | 990 | continue; |
991 | 991 | ||
992 | r = waitpid(line->cl_pid, NULL, WNOHANG); | 992 | r = safe_waitpid(line->cl_pid, NULL, WNOHANG); |
993 | if (r < 0 || r == line->cl_pid) { | 993 | if (r < 0 || r == line->cl_pid) { |
994 | process_finished_job(file->cf_username, line); | 994 | process_finished_job(file->cf_username, line); |
995 | if (line->cl_pid == 0) { | 995 | if (line->cl_pid == 0) { |
@@ -1001,6 +1001,14 @@ static int check_completions(void) | |||
1001 | /* else: r == 0: "process is still running" */ | 1001 | /* else: r == 0: "process is still running" */ |
1002 | file->cf_has_running = 1; | 1002 | file->cf_has_running = 1; |
1003 | } | 1003 | } |
1004 | |||
1005 | /* Reap any other children we don't actively track. | ||
1006 | * Reportedly, some people run crond as init process! | ||
1007 | * Thus, we need to reap orphans, like init does. | ||
1008 | */ | ||
1009 | while (wait_any_nohang(NULL) > 0) | ||
1010 | continue; | ||
1011 | |||
1004 | //FIXME: if !file->cf_has_running && file->deleted: delete it! | 1012 | //FIXME: if !file->cf_has_running && file->deleted: delete it! |
1005 | //otherwise deleted entries will stay forever, right? | 1013 | //otherwise deleted entries will stay forever, right? |
1006 | num_still_running += file->cf_has_running; | 1014 | num_still_running += file->cf_has_running; |
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 2934d8eb7..912a501a3 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c | |||
@@ -382,7 +382,7 @@ static void fb_drawimage(void) | |||
382 | if (LONE_DASH(G.image_filename)) { | 382 | if (LONE_DASH(G.image_filename)) { |
383 | theme_file = stdin; | 383 | theme_file = stdin; |
384 | } else { | 384 | } else { |
385 | int fd = open_zipped(G.image_filename, /*fail_if_not_compressed:*/ 0); | 385 | int fd = open_zipped(G.image_filename, /*die_if_not_compressed:*/ 0); |
386 | if (fd < 0) | 386 | if (fd < 0) |
387 | bb_simple_perror_msg_and_die(G.image_filename); | 387 | bb_simple_perror_msg_and_die(G.image_filename); |
388 | theme_file = xfdopen_for_read(fd); | 388 | theme_file = xfdopen_for_read(fd); |
diff --git a/miscutils/less.c b/miscutils/less.c index 467c76e2a..5a8fc5a74 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -1178,7 +1178,7 @@ static int64_t getch_nowait(void) | |||
1178 | 1178 | ||
1179 | /* We have kbd_fd in O_NONBLOCK mode, read inside safe_read_key() | 1179 | /* We have kbd_fd in O_NONBLOCK mode, read inside safe_read_key() |
1180 | * would not block even if there is no input available */ | 1180 | * would not block even if there is no input available */ |
1181 | key64 = safe_read_key(kbd_fd, kbd_input, /*timeout off:*/ -2); | 1181 | key64 = safe_read_key(kbd_fd, kbd_input, /*do not poll:*/ -2); |
1182 | if ((int)key64 == -1) { | 1182 | if ((int)key64 == -1) { |
1183 | if (errno == EAGAIN) { | 1183 | if (errno == EAGAIN) { |
1184 | /* No keyboard input available. Since poll() did return, | 1184 | /* No keyboard input available. Since poll() did return, |
diff --git a/miscutils/make.c b/miscutils/make.c index a165274aa..8026917b3 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -276,6 +276,7 @@ struct globals { | |||
276 | time_t ar_mtime; | 276 | time_t ar_mtime; |
277 | int lineno; // Physical line number in file | 277 | int lineno; // Physical line number in file |
278 | int dispno; // Line number for display purposes | 278 | int dispno; // Line number for display purposes |
279 | struct cmd *curr_cmd; | ||
279 | const char *rulepos; | 280 | const char *rulepos; |
280 | int rule_idx; | 281 | int rule_idx; |
281 | #define IF_MAX 10 | 282 | #define IF_MAX 10 |
@@ -307,6 +308,7 @@ struct globals { | |||
307 | #define ar_mtime (G.ar_mtime) | 308 | #define ar_mtime (G.ar_mtime) |
308 | #define lineno (G.lineno) | 309 | #define lineno (G.lineno) |
309 | #define dispno (G.dispno) | 310 | #define dispno (G.dispno) |
311 | #define curr_cmd (G.curr_cmd) | ||
310 | #define rulepos (G.rulepos) | 312 | #define rulepos (G.rulepos) |
311 | #define rule_idx (G.rule_idx) | 313 | #define rule_idx (G.rule_idx) |
312 | #define clevel (G.clevel) | 314 | #define clevel (G.clevel) |
@@ -338,9 +340,20 @@ static struct name *dyndep(struct name *np, struct rule *infrule, | |||
338 | static void | 340 | static void |
339 | vwarning(FILE *stream, const char *msg, va_list list) | 341 | vwarning(FILE *stream, const char *msg, va_list list) |
340 | { | 342 | { |
343 | const char *m = NULL; | ||
344 | int d = 0; | ||
345 | |||
346 | if (curr_cmd) { | ||
347 | m = curr_cmd->c_makefile; | ||
348 | d = curr_cmd->c_dispno; | ||
349 | } else if (makefile) { | ||
350 | m = makefile; | ||
351 | d = dispno; | ||
352 | } | ||
353 | |||
341 | fprintf(stream, "%s: ", applet_name); | 354 | fprintf(stream, "%s: ", applet_name); |
342 | if (makefile) | 355 | if (m) |
343 | fprintf(stream, "(%s:%d): ", makefile, dispno); | 356 | fprintf(stream, "(%s:%d): ", m, d); |
344 | vfprintf(stream, msg, list); | 357 | vfprintf(stream, msg, list); |
345 | fputc('\n', stream); | 358 | fputc('\n', stream); |
346 | } | 359 | } |
@@ -726,6 +739,7 @@ addrule(struct name *np, struct depend *dp, struct cmd *cp, int flag) | |||
726 | { | 739 | { |
727 | struct rule *rp; | 740 | struct rule *rp; |
728 | struct rule **rpp; | 741 | struct rule **rpp; |
742 | struct cmd *old_cp; | ||
729 | 743 | ||
730 | // Can't mix single-colon and double-colon rules | 744 | // Can't mix single-colon and double-colon rules |
731 | if (!posix && (np->n_flag & N_TARGET)) { | 745 | if (!posix && (np->n_flag & N_TARGET)) { |
@@ -742,7 +756,7 @@ addrule(struct name *np, struct depend *dp, struct cmd *cp, int flag) | |||
742 | return; | 756 | return; |
743 | } | 757 | } |
744 | 758 | ||
745 | if (cp && !(np->n_flag & N_DOUBLE) && getcmd(np)) { | 759 | if (cp && !(np->n_flag & N_DOUBLE) && (old_cp = getcmd(np))) { |
746 | // Handle the inference rule redefinition case | 760 | // Handle the inference rule redefinition case |
747 | // .DEFAULT rule can also be redefined (as an extension). | 761 | // .DEFAULT rule can also be redefined (as an extension). |
748 | if ((np->n_flag & N_INFERENCE) | 762 | if ((np->n_flag & N_INFERENCE) |
@@ -751,7 +765,17 @@ addrule(struct name *np, struct depend *dp, struct cmd *cp, int flag) | |||
751 | freerules(np->n_rule); | 765 | freerules(np->n_rule); |
752 | np->n_rule = NULL; | 766 | np->n_rule = NULL; |
753 | } else { | 767 | } else { |
754 | error("commands defined twice for target %s", np->n_name); | 768 | // We're adding commands to a single colon rule which |
769 | // already has some. Clear the old ones first. | ||
770 | warning("overriding rule for target %s", np->n_name); | ||
771 | curr_cmd = old_cp; | ||
772 | warning("previous rule for target %s", np->n_name); | ||
773 | curr_cmd = NULL; | ||
774 | |||
775 | for (rp = np->n_rule; rp; rp = rp->r_next) { | ||
776 | freecmds(rp->r_cmd); | ||
777 | rp->r_cmd = NULL; | ||
778 | } | ||
755 | } | 779 | } |
756 | } | 780 | } |
757 | 781 | ||
@@ -2602,8 +2626,7 @@ docmds(struct name *np, struct cmd *cp) | |||
2602 | uint32_t ssilent, signore, sdomake; | 2626 | uint32_t ssilent, signore, sdomake; |
2603 | 2627 | ||
2604 | // Location of command in makefile (for use in error messages) | 2628 | // Location of command in makefile (for use in error messages) |
2605 | makefile = cp->c_makefile; | 2629 | curr_cmd = cp; |
2606 | dispno = cp->c_dispno; | ||
2607 | opts &= ~OPT_make; // We want to know if $(MAKE) is expanded | 2630 | opts &= ~OPT_make; // We want to know if $(MAKE) is expanded |
2608 | q = command = expand_macros(cp->c_cmd, FALSE); | 2631 | q = command = expand_macros(cp->c_cmd, FALSE); |
2609 | ssilent = silent || (np->n_flag & N_SILENT) || dotouch; | 2632 | ssilent = silent || (np->n_flag & N_SILENT) || dotouch; |
@@ -2697,7 +2720,7 @@ docmds(struct name *np, struct cmd *cp) | |||
2697 | estat = MAKE_DIDSOMETHING; | 2720 | estat = MAKE_DIDSOMETHING; |
2698 | } | 2721 | } |
2699 | 2722 | ||
2700 | makefile = NULL; | 2723 | curr_cmd = NULL; |
2701 | return estat; | 2724 | return estat; |
2702 | } | 2725 | } |
2703 | 2726 | ||
diff --git a/miscutils/man.c b/miscutils/man.c index 3954455b4..38c1b9aa3 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
@@ -143,7 +143,7 @@ static int run_pipe(char *man_filename, int man, int level) | |||
143 | 143 | ||
144 | ordinary_manpage: | 144 | ordinary_manpage: |
145 | close(STDIN_FILENO); | 145 | close(STDIN_FILENO); |
146 | open_zipped(man_filename, /*fail_if_not_compressed:*/ 0); /* guaranteed to use fd 0 (STDIN_FILENO) */ | 146 | open_zipped(man_filename, /*die_if_not_compressed:*/ 0); /* guaranteed to use fd 0 (STDIN_FILENO) */ |
147 | if (man) { | 147 | if (man) { |
148 | int w = get_terminal_width(-1); | 148 | int w = get_terminal_width(-1); |
149 | if (w > 10) | 149 | if (w > 10) |