Compare commits

..
6 Commits
8 changed files with 91 additions and 54 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 9
SUBLEVEL = 1
SUBLEVEL = 2
EXTRAVERSION =
NAME = Unnamed
+7 -10
View File
@@ -71,12 +71,6 @@ static char *extract_filename(char *line, int patch_level)
return xstrdup(filename_start_ptr);
}
static int file_doesnt_exist(const char *filename)
{
struct stat statbuf;
return stat(filename, &statbuf);
}
int patch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int patch_main(int argc, char **argv)
{
@@ -84,7 +78,8 @@ int patch_main(int argc, char **argv)
char *patch_line;
int ret;
FILE *patch_file = NULL;
struct stat saved_stat;
{
char *p, *i;
ret = getopt32(argv, "p:i:", &p, &i);
@@ -134,8 +129,9 @@ int patch_main(int argc, char **argv)
}
new_filename = extract_filename(patch_line, patch_level);
free(patch_line);
if (file_doesnt_exist(new_filename)) {
/* Get access rights from the file to be patched, -1 file does not exist */
if (stat(new_filename, &saved_stat)) {
char *line_ptr;
/* Create leading directories */
line_ptr = strrchr(new_filename, '/');
@@ -155,9 +151,10 @@ int patch_main(int argc, char **argv)
backup_filename);
}
dst_stream = xfopen(new_filename, "w");
fchmod(fileno(dst_stream), saved_stat.st_mode);
}
if ((backup_filename == NULL) || file_doesnt_exist(original_filename)) {
if ((backup_filename == NULL) || stat(original_filename, &saved_stat)) {
src_stream = NULL;
} else {
if (strcmp(original_filename, new_filename) == 0) {
+16 -2
View File
@@ -225,8 +225,22 @@ static void console_init(void)
}
messageD(L_LOG, "console='%s'", s);
} else {
/* Make sure fd 0,1,2 are not closed */
bb_sanitize_stdio();
/* Make sure fd 0,1,2 are not closed
* (so that they won't be used by future opens) */
/* bb_sanitize_stdio(); - WRONG.
* Fail if "/dev/null" doesnt exist, and for init
* this is a real possibility! Open code it instead. */
int fd = open(bb_dev_null, O_RDWR);
if (fd < 0) {
/* Give me _ANY_ open descriptor! */
fd = xopen("/", O_RDONLY); /* we don't believe this can fail */
}
while ((unsigned)fd < 2)
fd = dup(fd);
if (fd > 2)
close (fd);
}
s = getenv("TERM");
+9 -1
View File
@@ -246,7 +246,15 @@ static void input_backward(unsigned num)
if (cmdedit_x >= num) {
cmdedit_x -= num;
if (num <= 4) {
printf("\b\b\b\b" + (4-num));
/* This is longer by 5 bytes on x86.
* Also gets mysteriously
* miscompiled for some ARM users.
* printf(("\b\b\b\b" + 4) - num);
* return;
*/
do {
bb_putchar('\b');
} while (--num);
return;
}
printf("\033[%uD", num);
+1 -1
View File
@@ -1950,7 +1950,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
if ((STRNCASECMP(iobuf, "Content-length:") == 0)) {
/* extra read only for POST */
if (prequest != request_GET) {
tptr = iobuf + sizeof("Content-length:") - 1;
tptr = skip_whitespace(iobuf + sizeof("Content-length:") - 1);
if (!tptr[0])
send_headers_and_exit(HTTP_BAD_REQUEST);
errno = 0;
+1 -1
View File
@@ -167,7 +167,7 @@ static int read_opt(const char *const_line, void *arg)
if (!opt)
return 0;
idx = index_in_strings(opt, dhcp_option_strings); /* NB: was strcasecmp! */
idx = index_in_strings(dhcp_option_strings, opt); /* NB: was strcasecmp! */
if (idx < 0)
return 0;
option = &dhcp_options[idx];
+33 -19
View File
@@ -6,12 +6,42 @@ objtree := $(CURDIR)
src := $(srctree)
obj := $(objtree)
# Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree)
default: busybox
ifndef HOSTCC
HOSTCC = cc
endif
AS = $(CROSS_COMPILE)as
CC = $(CROSS_COMPILE)gcc
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS := $(CFLAGS)
CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q
WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,)
include .config
# We need some generic definitions
include $(srctree)/scripts/Kbuild.include
include Makefile.flags
ifdef CONFIG_FEATURE_COMPRESS_USAGE
usage_stuff = include/usage_compressed.h
endif
ifndef BB_VER
BB_VER:=""
endif
# pull in the config stuff
lib-all-y := applets/applets.o
lib-y:=
@@ -96,6 +126,9 @@ lib-y:=
include libpwdgrp/Kbuild
lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y)))
lib-y:=
include ipsvd/Kbuild
lib-all-y += $(patsubst %,ipsvd/%,$(sort $(lib-y)))
lib-y:=
include editors/Kbuild
lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y)))
lib-y:=
@@ -109,25 +142,6 @@ include libbb/Kbuild
lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y)))
lib-y:=
include Makefile.flags
ifndef BB_VER
BB_VER:=""
endif
CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q
HOSTCC = gcc
AS = $(CROSS_COMPILE)as
CC = $(CROSS_COMPILE)gcc
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,)
busybox: $(usage_stuff)
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) --combine $(WHOLE_PROGRAM) \
-funit-at-a-time -Wno-error -std=gnu99 \
+23 -19
View File
@@ -8,28 +8,32 @@
*/
#include "libbb.h"
#if !defined CONFIG_SYSLOGD
/* SYSLOG_NAMES defined to pull prioritynames[] and facilitynames[]
* from syslog.h. Grrrr - glibc puts those in _rwdata_! :( */
#ifndef CONFIG_SYSLOGD
#define SYSLOG_NAMES
#define SYSLOG_NAMES_CONST /* uclibc is saner :) */
#include <sys/syslog.h>
#define SYSLOG_NAMES_CONST
#include <syslog.h>
#else
#include <sys/syslog.h>
# ifndef __dietlibc__
/* We have to do this since the header file defines static
* structures. Argh.... bad libc, bad, bad...
*/
typedef struct _code {
char *c_name;
int c_val;
} CODE;
extern CODE prioritynames[];
extern CODE facilitynames[];
/* brokenness alert. Everybody except dietlibc get's this wrong by neither
* providing a typedef nor an extern for facilitynames and prioritynames
* in syslog.h.
*/
# include <syslog.h>
# ifndef __dietlibc__
/* We have to do this since the header file does neither provide a sane type
* for this structure nor extern definitions. Argh.... bad libc, bad, bad...
*/
typedef struct _code {
char *c_name; /* FIXME: this should be const char *const c_name ! */
int c_val;
} CODE;
# ifdef __UCLIBC__
extern const CODE prioritynames[];
extern const CODE facilitynames[];
# else
extern CODE prioritynames[];
extern CODE facilitynames[];
# endif
# endif
#endif
/* Decode a symbolic name to a numeric value