Compare commits

...
3 Commits
9 changed files with 38 additions and 26 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 7
SUBLEVEL = 2
SUBLEVEL = 5
EXTRAVERSION =
NAME = Unnamed
+14 -7
View File
@@ -47,13 +47,16 @@ static void tail_xprint_header(const char *fmt, const char *filename)
static ssize_t tail_read(int fd, char *buf, size_t count)
{
ssize_t r;
off_t current, end;
off_t current;
struct stat sbuf;
end = current = lseek(fd, 0, SEEK_CUR);
if (!fstat(fd, &sbuf))
end = sbuf.st_size;
lseek(fd, end < current ? 0 : current, SEEK_SET);
/* (A good comment is missing here) */
current = lseek(fd, 0, SEEK_CUR);
/* /proc files report zero st_size, don't lseek them. */
if (fstat(fd, &sbuf) == 0 && sbuf.st_size)
if (sbuf.st_size < current)
lseek(fd, 0, SEEK_SET);
r = safe_read(fd, buf, count);
if (r < 0) {
bb_perror_msg(bb_msg_read_error);
@@ -67,8 +70,12 @@ static const char header_fmt[] ALIGN1 = "\n==> %s <==\n";
static unsigned eat_num(const char *p)
{
if (*p == '-') p++;
else if (*p == '+') { p++; G.status = EXIT_FAILURE; }
if (*p == '-')
p++;
else if (*p == '+') {
p++;
G.status = EXIT_FAILURE;
}
return xatou_sfx(p, tail_suffixes);
}
+11 -4
View File
@@ -154,14 +154,14 @@ static int grep_file(FILE *file)
while ((line = xmalloc_getline(file)) != NULL) {
llist_t *pattern_ptr = pattern_head;
grep_list_data_t * gl;
grep_list_data_t *gl = gl; /* for gcc */
linenum++;
ret = 0;
while (pattern_ptr) {
gl = (grep_list_data_t *)pattern_ptr->data;
if (FGREP_FLAG) {
ret = strstr(line, gl->pattern) != NULL;
ret |= (strstr(line, gl->pattern) != NULL);
} else {
/*
* test for a postitive-assertion match (regexec returns success (0)
@@ -255,8 +255,15 @@ static int grep_file(FILE *file)
print_n_lines_after = lines_after;
#endif
if (option_mask32 & OPT_o) {
line[regmatch.rm_eo] = '\0';
print_line(line + regmatch.rm_so, linenum, ':');
if (FGREP_FLAG) {
/* -Fo just prints the pattern
* (unless -v: -Fov doesnt print anything at all) */
if (ret)
print_line(gl->pattern, linenum, ':');
} else {
line[regmatch.rm_eo] = '\0';
print_line(line + regmatch.rm_so, linenum, ':');
}
} else {
print_line(line, linenum, ':');
}
+1 -1
View File
@@ -776,7 +776,7 @@ char *bb_simplify_path(const char *path);
extern void bb_do_delay(int seconds);
extern void change_identity(const struct passwd *pw);
extern const char *change_identity_e2str(const struct passwd *pw);
extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args);
extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN;
#if ENABLE_SELINUX
extern void renew_current_security_context(void);
extern void set_current_security_context(security_context_t sid);
+3
View File
@@ -1186,6 +1186,9 @@ static void send_cgi_and_exit(
* and send it to the peer. So please no SIGPIPEs! */
signal(SIGPIPE, SIG_IGN);
/* Accound for POSTDATA already in hdr_buf */
bodyLen -= hdr_cnt;
/* This loop still looks messy. What is an exit criteria?
* "CGI's output closed"? Or "CGI has exited"?
* What to do if CGI has closed both input and output, but
+2 -1
View File
@@ -734,7 +734,8 @@ static servtab_t *getconfigent(void)
/* if ((arg = skip(&cp, 1)) == NULL) */
/* goto more; */
sep->se_server = xxstrdup(skip(&cp));
arg = skip(&cp);
sep->se_server = xxstrdup(arg);
if (strcmp(sep->se_server, "internal") == 0) {
#ifdef INETD_FEATURE_ENABLED
const struct builtin *bi;
+2 -2
View File
@@ -241,12 +241,12 @@ static void parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
} else if (key == ARG_remote) {
NEXT_ARG();
key = index_in_strings(keywords, *argv);
if (key == ARG_any)
if (key != ARG_any)
p->iph.daddr = get_addr32(*argv);
} else if (key == ARG_local) {
NEXT_ARG();
key = index_in_strings(keywords, *argv);
if (key == ARG_any)
if (key != ARG_any)
p->iph.saddr = get_addr32(*argv);
} else if (key == ARG_dev) {
NEXT_ARG();
+1 -7
View File
@@ -4379,6 +4379,7 @@ clear_traps(void)
/* Lives far away from here, needed for forkchild */
static void closescript(void);
/* Called after fork(), in child */
static void
forkchild(struct job *jp, union node *n, int mode)
@@ -4423,15 +4424,8 @@ forkchild(struct job *jp, union node *n, int mode)
setsignal(SIGQUIT);
setsignal(SIGTERM);
}
#if JOBS
/* For "jobs | cat" to work like in bash, we must retain list of jobs
* in child, but we do need to remove ourself */
if (jp)
freejob(jp);
#else
for (jp = curjob; jp; jp = jp->prev_job)
freejob(jp);
#endif
jobless = 0;
}
+3 -3
View File
@@ -107,7 +107,7 @@ int logger_main(int argc, char **argv)
argv += optind;
if (!argc) {
#define strbuf bb_common_bufsiz1
while (fgets(strbuf, BUFSIZ, stdin)) {
while (fgets(strbuf, COMMON_BUFSIZE, stdin)) {
if (strbuf[0]
&& NOT_LONE_CHAR(strbuf, '\n')
) {
@@ -117,11 +117,11 @@ int logger_main(int argc, char **argv)
}
} else {
char *message = NULL;
int len = 1; /* for NUL */
int len = 0;
int pos = 0;
do {
len += strlen(*argv) + 1;
message = xrealloc(message, len);
message = xrealloc(message, len + 1);
sprintf(message + pos, " %s", *argv),
pos = len;
} while (*++argv);