mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 18:33:06 +00:00
last_patch116 from vodz:
Stephane, >Using busybox+uclibc, crond syslog messages look like: > >Oct 9 09:04:46 soekris cron.notice crond[347]: ^Icrond 2.3.2 dillon, >started, log level 8 Thanks for testing. >The attached patch corrects the problem. Your patch is not correct. Correct patch attached. Also. Last patch have - add "Broken pipe" message to ash.c - busybox ash synced with dash_0.4.18 --w vodz
This commit is contained in:
parent
514633bf3f
commit
a48b0a3af7
@ -114,24 +114,26 @@ static void
|
|||||||
crondlog(const char *ctl, ...)
|
crondlog(const char *ctl, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
|
const char *fmt;
|
||||||
int level = (int)(ctl[0] & 0xf);
|
int level = (int)(ctl[0] & 0xf);
|
||||||
int type = level == 20 ?
|
int type = level == 20 ?
|
||||||
LOG_ERR : ((ctl[0] & 0100) ? LOG_WARNING : LOG_NOTICE);
|
LOG_ERR : ((ctl[0] & 0100) ? LOG_WARNING : LOG_NOTICE);
|
||||||
|
|
||||||
|
|
||||||
va_start(va, ctl);
|
va_start(va, ctl);
|
||||||
|
fmt = ctl+1;
|
||||||
if (level >= LogLevel) {
|
if (level >= LogLevel) {
|
||||||
|
|
||||||
#ifdef FEATURE_DEBUG_OPT
|
#ifdef FEATURE_DEBUG_OPT
|
||||||
if (DebugOpt) vfprintf(stderr, ctl, va);
|
if (DebugOpt) vfprintf(stderr, fmt, va);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (LogFile == 0) vsyslog(type, ctl, va);
|
if (LogFile == 0) vsyslog(type, fmt, va);
|
||||||
else {
|
else {
|
||||||
int logfd;
|
int logfd;
|
||||||
|
|
||||||
if ((logfd = open(LogFile, O_WRONLY|O_CREAT|O_APPEND, 600)) >= 0) {
|
if ((logfd = open(LogFile, O_WRONLY|O_CREAT|O_APPEND, 600)) >= 0) {
|
||||||
vdprintf(logfd, ctl, va);
|
vdprintf(logfd, fmt, va);
|
||||||
close(logfd);
|
close(logfd);
|
||||||
#ifdef FEATURE_DEBUG_OPT
|
#ifdef FEATURE_DEBUG_OPT
|
||||||
} else {
|
} else {
|
||||||
|
28
shell/ash.c
28
shell/ash.c
@ -6682,18 +6682,24 @@ sprint_status(char *s, int status, int sigonly)
|
|||||||
int st;
|
int st;
|
||||||
|
|
||||||
col = 0;
|
col = 0;
|
||||||
st = WEXITSTATUS(status);
|
|
||||||
if (!WIFEXITED(status)) {
|
if (!WIFEXITED(status)) {
|
||||||
st = WTERMSIG(status);
|
|
||||||
#if JOBS
|
#if JOBS
|
||||||
if (WIFSTOPPED(status))
|
if (WIFSTOPPED(status))
|
||||||
st = WSTOPSIG(status);
|
st = WSTOPSIG(status);
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
st = WTERMSIG(status);
|
||||||
if (sigonly) {
|
if (sigonly) {
|
||||||
if (st == SIGINT || st == SIGPIPE)
|
if(st == SIGPIPE) {
|
||||||
|
col = fmtstr(s, 16, "Broken pipe");
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
if (st == SIGINT)
|
||||||
|
goto out;
|
||||||
|
#if JOBS
|
||||||
if (WIFSTOPPED(status))
|
if (WIFSTOPPED(status))
|
||||||
goto out;
|
goto out;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
st &= 0x7f;
|
st &= 0x7f;
|
||||||
col = fmtstr(s, 32, u_signal_names(NULL, &st, 0));
|
col = fmtstr(s, 32, u_signal_names(NULL, &st, 0));
|
||||||
@ -6701,6 +6707,7 @@ sprint_status(char *s, int status, int sigonly)
|
|||||||
col += fmtstr(s + col, 16, " (core dumped)");
|
col += fmtstr(s + col, 16, " (core dumped)");
|
||||||
}
|
}
|
||||||
} else if (!sigonly) {
|
} else if (!sigonly) {
|
||||||
|
st = WEXITSTATUS(status);
|
||||||
if (st)
|
if (st)
|
||||||
col = fmtstr(s, 16, "Done(%d)", st);
|
col = fmtstr(s, 16, "Done(%d)", st);
|
||||||
else
|
else
|
||||||
@ -9036,18 +9043,19 @@ getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *opt
|
|||||||
char c = '?';
|
char c = '?';
|
||||||
int done = 0;
|
int done = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
char s[10];
|
char s[12];
|
||||||
char **optnext = optfirst + *param_optind - 1;
|
char **optnext;
|
||||||
|
|
||||||
if (*param_optind <= 1 || *optoff < 0 || !(*(optnext - 1)) ||
|
if(*param_optind < 1)
|
||||||
strlen(*(optnext - 1)) < *optoff)
|
return 1;
|
||||||
|
optnext = optfirst + *param_optind - 1;
|
||||||
|
|
||||||
|
if (*param_optind <= 1 || *optoff < 0 || strlen(optnext[-1]) < *optoff)
|
||||||
p = NULL;
|
p = NULL;
|
||||||
else
|
else
|
||||||
p = *(optnext - 1) + *optoff;
|
p = optnext[-1] + *optoff;
|
||||||
if (p == NULL || *p == '\0') {
|
if (p == NULL || *p == '\0') {
|
||||||
/* Current word is done, advance */
|
/* Current word is done, advance */
|
||||||
if (optnext == NULL)
|
|
||||||
return 1;
|
|
||||||
p = *optnext;
|
p = *optnext;
|
||||||
if (p == NULL || *p != '-' || *++p == '\0') {
|
if (p == NULL || *p != '-' || *++p == '\0') {
|
||||||
atend:
|
atend:
|
||||||
|
Loading…
Reference in New Issue
Block a user