aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--coreutils/tail.c21
-rw-r--r--include/libbb.h2
-rw-r--r--networking/httpd.c3
-rw-r--r--networking/inetd.c5
-rw-r--r--networking/libiproute/iptunnel.c4
-rw-r--r--shell/ash.c8
-rw-r--r--sysklogd/logger.c6
8 files changed, 28 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 9b9c9c464..a258503b6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 7
-SUBLEVEL = 2
+SUBLEVEL = 3
EXTRAVERSION =
NAME = Unnamed
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 74e14232d..8a112346d 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -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);
}
diff --git a/include/libbb.h b/include/libbb.h
index 140e21dea..76178b15f 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -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);
diff --git a/networking/httpd.c b/networking/httpd.c
index e67e6bd64..139e913f1 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -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
diff --git a/networking/inetd.c b/networking/inetd.c
index e4e9f95b0..85e9ae732 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -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;
@@ -759,7 +760,7 @@ static servtab_t *getconfigent(void)
sep->se_bi = NULL;
#endif
argc = 0;
- for (arg = skip(&cp); cp; arg = skip(&cp)) {
+ for (; cp; arg = skip(&cp)) {
if (argc < MAXARGV)
sep->se_argv[argc++] = xxstrdup(arg);
}
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index 2b1713556..6d3a74165 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -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();
diff --git a/shell/ash.c b/shell/ash.c
index 46f00dd3d..02cd6b77c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -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;
}
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index df5d8ff7e..6e1debd67 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -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);