aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-05-27 11:56:52 +0100
committerRon Yorston <rmy@pobox.com>2019-05-27 11:56:52 +0100
commita61949401890cbb33a9d6c4571b51c53460ad438 (patch)
tree64dedaddb89896d5b1670a421af123670ca2120b /miscutils
parent03a7b173605a890e1db5177ecd5b8dd591081c41 (diff)
parentbcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a (diff)
downloadbusybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.tar.gz
busybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.tar.bz2
busybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/crond.c6
-rw-r--r--miscutils/dc.c27
-rw-r--r--miscutils/devfsd.c2
3 files changed, 24 insertions, 11 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 25e5503c7..b533a3991 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -181,9 +181,7 @@ static void crondlog(unsigned level, const char *msg, va_list va)
181 * need not touch syslog_level 181 * need not touch syslog_level
182 * (they are ok with LOG_ERR default). 182 * (they are ok with LOG_ERR default).
183 */ 183 */
184 syslog_level = LOG_INFO; 184 bb_vinfo_msg(msg, va);
185 bb_verror_msg(msg, va, /* strerr: */ NULL);
186 syslog_level = LOG_ERR;
187 } 185 }
188} 186}
189 187
@@ -1108,7 +1106,7 @@ int crond_main(int argc UNUSED_PARAM, char **argv)
1108 process_cron_update_file(); 1106 process_cron_update_file();
1109 log5("wakeup dt=%ld", dt); 1107 log5("wakeup dt=%ld", dt);
1110 if (dt < -60 * 60 || dt > 60 * 60) { 1108 if (dt < -60 * 60 || dt > 60 * 60) {
1111 bb_error_msg("time disparity of %ld minutes detected", dt / 60); 1109 bb_info_msg("time disparity of %ld minutes detected", dt / 60);
1112 /* and we do not run any jobs in this case */ 1110 /* and we do not run any jobs in this case */
1113 } else if (dt > 0) { 1111 } else if (dt > 0) {
1114 /* Usual case: time advances forward, as expected */ 1112 /* Usual case: time advances forward, as expected */
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 0d09f5e2b..c7ce2be0b 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -35,10 +35,12 @@ enum { STACK_SIZE = (COMMON_BUFSIZE - offsetof(struct globals, stack)) / sizeof(
35 base = 10; \ 35 base = 10; \
36} while (0) 36} while (0)
37 37
38static void check_under(void) 38static unsigned check_under(void)
39{ 39{
40 if (pointer == 0) 40 unsigned p = pointer;
41 if (p == 0)
41 bb_error_msg_and_die("stack underflow"); 42 bb_error_msg_and_die("stack underflow");
43 return p - 1;
42} 44}
43 45
44static void push(double a) 46static void push(double a)
@@ -50,8 +52,9 @@ static void push(double a)
50 52
51static double pop(void) 53static double pop(void)
52{ 54{
53 check_under(); 55 unsigned p = check_under();
54 return stack[--pointer]; 56 pointer = p;
57 return stack[p];
55} 58}
56 59
57static void add(void) 60static void add(void)
@@ -91,6 +94,19 @@ static void mod(void)
91{ 94{
92 data_t d = pop(); 95 data_t d = pop();
93 96
97 /* compat with dc (GNU bc 1.07.1) 1.4.1:
98 * $ dc -e '4 0 % p'
99 * dc: remainder by zero
100 * 0
101 */
102 if (d == 0) {
103 bb_error_msg("remainder by zero");
104 pop();
105 push(0);
106 return;
107 }
108 /* ^^^^ without this, we simply get SIGFPE and die */
109
94 push((data_t) pop() % d); 110 push((data_t) pop() % d);
95} 111}
96 112
@@ -171,8 +187,7 @@ static void print_stack_no_pop(void)
171 187
172static void print_no_pop(void) 188static void print_no_pop(void)
173{ 189{
174 check_under(); 190 print_base(stack[check_under()]);
175 print_base(stack[pointer-1]);
176} 191}
177 192
178struct op { 193struct op {
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 3bf06b965..e4d104d0c 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -343,7 +343,7 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
343 343
344/* Busybox stuff */ 344/* Busybox stuff */
345#if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG 345#if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG
346#define info_logger(p, fmt, args...) bb_error_msg(fmt, ## args) 346#define info_logger(p, fmt, args...) bb_info_msg(fmt, ## args)
347#define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args) 347#define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args)
348#define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args) 348#define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args)
349#define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args) 349#define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args)