summaryrefslogtreecommitdiff
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 @@
1VERSION = 1 1VERSION = 1
2PATCHLEVEL = 7 2PATCHLEVEL = 7
3SUBLEVEL = 2 3SUBLEVEL = 3
4EXTRAVERSION = 4EXTRAVERSION =
5NAME = Unnamed 5NAME = Unnamed
6 6
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)
47static ssize_t tail_read(int fd, char *buf, size_t count) 47static ssize_t tail_read(int fd, char *buf, size_t count)
48{ 48{
49 ssize_t r; 49 ssize_t r;
50 off_t current, end; 50 off_t current;
51 struct stat sbuf; 51 struct stat sbuf;
52 52
53 end = current = lseek(fd, 0, SEEK_CUR); 53 /* (A good comment is missing here) */
54 if (!fstat(fd, &sbuf)) 54 current = lseek(fd, 0, SEEK_CUR);
55 end = sbuf.st_size; 55 /* /proc files report zero st_size, don't lseek them. */
56 lseek(fd, end < current ? 0 : current, SEEK_SET); 56 if (fstat(fd, &sbuf) == 0 && sbuf.st_size)
57 if (sbuf.st_size < current)
58 lseek(fd, 0, SEEK_SET);
59
57 r = safe_read(fd, buf, count); 60 r = safe_read(fd, buf, count);
58 if (r < 0) { 61 if (r < 0) {
59 bb_perror_msg(bb_msg_read_error); 62 bb_perror_msg(bb_msg_read_error);
@@ -67,8 +70,12 @@ static const char header_fmt[] ALIGN1 = "\n==> %s <==\n";
67 70
68static unsigned eat_num(const char *p) 71static unsigned eat_num(const char *p)
69{ 72{
70 if (*p == '-') p++; 73 if (*p == '-')
71 else if (*p == '+') { p++; G.status = EXIT_FAILURE; } 74 p++;
75 else if (*p == '+') {
76 p++;
77 G.status = EXIT_FAILURE;
78 }
72 return xatou_sfx(p, tail_suffixes); 79 return xatou_sfx(p, tail_suffixes);
73} 80}
74 81
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);
776extern void bb_do_delay(int seconds); 776extern void bb_do_delay(int seconds);
777extern void change_identity(const struct passwd *pw); 777extern void change_identity(const struct passwd *pw);
778extern const char *change_identity_e2str(const struct passwd *pw); 778extern const char *change_identity_e2str(const struct passwd *pw);
779extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args); 779extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN;
780#if ENABLE_SELINUX 780#if ENABLE_SELINUX
781extern void renew_current_security_context(void); 781extern void renew_current_security_context(void);
782extern void set_current_security_context(security_context_t sid); 782extern 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(
1186 * and send it to the peer. So please no SIGPIPEs! */ 1186 * and send it to the peer. So please no SIGPIPEs! */
1187 signal(SIGPIPE, SIG_IGN); 1187 signal(SIGPIPE, SIG_IGN);
1188 1188
1189 /* Accound for POSTDATA already in hdr_buf */
1190 bodyLen -= hdr_cnt;
1191
1189 /* This loop still looks messy. What is an exit criteria? 1192 /* This loop still looks messy. What is an exit criteria?
1190 * "CGI's output closed"? Or "CGI has exited"? 1193 * "CGI's output closed"? Or "CGI has exited"?
1191 * What to do if CGI has closed both input and output, but 1194 * 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)
734 /* if ((arg = skip(&cp, 1)) == NULL) */ 734 /* if ((arg = skip(&cp, 1)) == NULL) */
735 /* goto more; */ 735 /* goto more; */
736 736
737 sep->se_server = xxstrdup(skip(&cp)); 737 arg = skip(&cp);
738 sep->se_server = xxstrdup(arg);
738 if (strcmp(sep->se_server, "internal") == 0) { 739 if (strcmp(sep->se_server, "internal") == 0) {
739#ifdef INETD_FEATURE_ENABLED 740#ifdef INETD_FEATURE_ENABLED
740 const struct builtin *bi; 741 const struct builtin *bi;
@@ -759,7 +760,7 @@ static servtab_t *getconfigent(void)
759 sep->se_bi = NULL; 760 sep->se_bi = NULL;
760#endif 761#endif
761 argc = 0; 762 argc = 0;
762 for (arg = skip(&cp); cp; arg = skip(&cp)) { 763 for (; cp; arg = skip(&cp)) {
763 if (argc < MAXARGV) 764 if (argc < MAXARGV)
764 sep->se_argv[argc++] = xxstrdup(arg); 765 sep->se_argv[argc++] = xxstrdup(arg);
765 } 766 }
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)
241 } else if (key == ARG_remote) { 241 } else if (key == ARG_remote) {
242 NEXT_ARG(); 242 NEXT_ARG();
243 key = index_in_strings(keywords, *argv); 243 key = index_in_strings(keywords, *argv);
244 if (key == ARG_any) 244 if (key != ARG_any)
245 p->iph.daddr = get_addr32(*argv); 245 p->iph.daddr = get_addr32(*argv);
246 } else if (key == ARG_local) { 246 } else if (key == ARG_local) {
247 NEXT_ARG(); 247 NEXT_ARG();
248 key = index_in_strings(keywords, *argv); 248 key = index_in_strings(keywords, *argv);
249 if (key == ARG_any) 249 if (key != ARG_any)
250 p->iph.saddr = get_addr32(*argv); 250 p->iph.saddr = get_addr32(*argv);
251 } else if (key == ARG_dev) { 251 } else if (key == ARG_dev) {
252 NEXT_ARG(); 252 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)
4379 4379
4380/* Lives far away from here, needed for forkchild */ 4380/* Lives far away from here, needed for forkchild */
4381static void closescript(void); 4381static void closescript(void);
4382
4382/* Called after fork(), in child */ 4383/* Called after fork(), in child */
4383static void 4384static void
4384forkchild(struct job *jp, union node *n, int mode) 4385forkchild(struct job *jp, union node *n, int mode)
@@ -4423,15 +4424,8 @@ forkchild(struct job *jp, union node *n, int mode)
4423 setsignal(SIGQUIT); 4424 setsignal(SIGQUIT);
4424 setsignal(SIGTERM); 4425 setsignal(SIGTERM);
4425 } 4426 }
4426#if JOBS
4427 /* For "jobs | cat" to work like in bash, we must retain list of jobs
4428 * in child, but we do need to remove ourself */
4429 if (jp)
4430 freejob(jp);
4431#else
4432 for (jp = curjob; jp; jp = jp->prev_job) 4427 for (jp = curjob; jp; jp = jp->prev_job)
4433 freejob(jp); 4428 freejob(jp);
4434#endif
4435 jobless = 0; 4429 jobless = 0;
4436} 4430}
4437 4431
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)
107 argv += optind; 107 argv += optind;
108 if (!argc) { 108 if (!argc) {
109#define strbuf bb_common_bufsiz1 109#define strbuf bb_common_bufsiz1
110 while (fgets(strbuf, BUFSIZ, stdin)) { 110 while (fgets(strbuf, COMMON_BUFSIZE, stdin)) {
111 if (strbuf[0] 111 if (strbuf[0]
112 && NOT_LONE_CHAR(strbuf, '\n') 112 && NOT_LONE_CHAR(strbuf, '\n')
113 ) { 113 ) {
@@ -117,11 +117,11 @@ int logger_main(int argc, char **argv)
117 } 117 }
118 } else { 118 } else {
119 char *message = NULL; 119 char *message = NULL;
120 int len = 1; /* for NUL */ 120 int len = 0;
121 int pos = 0; 121 int pos = 0;
122 do { 122 do {
123 len += strlen(*argv) + 1; 123 len += strlen(*argv) + 1;
124 message = xrealloc(message, len); 124 message = xrealloc(message, len + 1);
125 sprintf(message + pos, " %s", *argv), 125 sprintf(message + pos, " %s", *argv),
126 pos = len; 126 pos = len;
127 } while (*++argv); 127 } while (*++argv);