Compare commits

...
10 Commits
Author SHA1 Message Date
Denys Vlasenko b84194b133 Bump version to 1.29.3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-09 20:56:49 +02:00
Denys Vlasenko 2993551efc Revert "libbb: remove unnecessary variable in xmalloc_fgets"
The variable is in fact necessary.

    commit 2da9724b56
    Author: Quentin Rameau <quinq@fifth.space>
    Date:   Sun Apr 1 17:05:35 2018 +0200
        libbb: remove unnecessary variable in xmalloc_fgets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-02 18:48:50 +02:00
Denys Vlasenko ab4caf099c Bump version to 1.29.2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-31 14:31:12 +02:00
Denys Vlasenko 1c3bcfc79f fdisk: sync up with some util-linux 2.31 behavior
= display default is no longer in cylinders
= +sizeC is no longer supported
= add +sizeT suffix - terabytes are here
= K,M,G,T and k,m,g,t suffixes all are binary, not decimal
= +sizeM results in last sector +(size * 1Mbyte - 1), not +(size * 1Mbyte)
= fix comparison to "YES" answer for sgi/sun

function                                             old     new   delta
read_int                                             492     519     +27
fdisk_main                                          2644    2640      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 27/-4)              Total: 23 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-30 18:02:27 +02:00
Denys Vlasenko 096ccd6a69 fdisk: use strtoul[l] instead of atoi, closes 11176
Couldn't create partitions bigger than 1TB (when using 512 bytes sectors,
on 32 bits architectures).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-30 18:02:27 +02:00
Denys Vlasenko d674b2e2ae gzip: unbreak FEATURE_GZIP_LEVELS, closes 11171
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-30 18:02:27 +02:00
Denys Vlasenko abe8fc3663 hexedit: fixes for redraw and down movement causing SEGV on attempt to access
"Go to:" command was not updating row position, making next "down" movements
for one screenful print empty lines instead of showing the contents.

If the file is whole pages long, "down" movement at EOF was advancing position
+16 bytes, mapping the next portion (entirely past the end of the file),
then finding out that the new position is beyond the EOF, rolling it back
-16 bytes... ending up with this postion pointing *before* the mapped portion.
Any next access (e.g. "move right" key) SEGVs.

function                                             old     new   delta
hexedit_main                                        1170    1184     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-30 18:02:27 +02:00
Denys Vlasenko 981c0b109d Bump version to 1.29.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-15 14:55:20 +02:00
Raffaello D. Di Napoli 6673497d3b sendmail: fix parsing of addresses in angle brackets
Pointer e needs to be wound back in order to overwrite '>' with '\0'.
Regression introduced in 20077c1429

Signed-off-by: Raffaello D. Di Napoli <rafdev@dinapo.li>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-15 14:52:21 +02:00
Denys Vlasenko 7236b6d717 wget: fix fetching of https URLs without http proxy
The "fix fetching of https URLs with http proxy" commit
broke the usual http-to-https redirect:

$ wget http://busybox.net/downloads/busybox-1.29.0.tar.bz2
Connecting to busybox.net (140.211.167.122:80)
Connecting to busybox.net (140.211.167.122:443)
wget: server returned error: HTTP/1.1 400 Bad Request

Fixing...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-15 14:52:21 +02:00
9 changed files with 68 additions and 61 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 29
SUBLEVEL = 0
SUBLEVEL = 3
EXTRAVERSION =
NAME = Unnamed
+6 -6
View File
@@ -333,12 +333,6 @@ struct globals {
/* DECLARE(Pos, head, 1<<HASH_BITS); */
#define head (G1.prev + WSIZE) /* hash head (see deflate.c) */
/* =========================================================================== */
/* all members below are zeroed out in pack_gzip() for each next file */
uint32_t crc; /* shift register contents */
/*uint32_t *crc_32_tab;*/
#if ENABLE_FEATURE_GZIP_LEVELS
unsigned max_chain_length;
unsigned max_lazy_match;
@@ -350,6 +344,12 @@ struct globals {
#define nice_match (G1.nice_match)
#endif
/* =========================================================================== */
/* all members below are zeroed out in pack_gzip() for each next file */
uint32_t crc; /* shift register contents */
/*uint32_t *crc_32_tab;*/
/* window position at the beginning of the current output block. Gets
* negative when the window is moved backwards.
*/
+3 -1
View File
@@ -47,7 +47,9 @@ char* FAST_FUNC bb_get_chunk_from_file(FILE *file, size_t *end)
/* Get line, including trailing \n if any */
char* FAST_FUNC xmalloc_fgets(FILE *file)
{
return bb_get_chunk_from_file(file, NULL);
size_t i;
return bb_get_chunk_from_file(file, &i);
}
/* Get line. Remove trailing \n */
char* FAST_FUNC xmalloc_fgetline(FILE *file)
+1 -1
View File
@@ -173,7 +173,7 @@ static char *angle_address(char *str)
char *s, *e;
e = trim(str);
if (e != str && e[-1] == '>') {
if (e != str && *--e == '>') {
s = strrchr(str, '<');
if (s) {
*e = '\0';
+4 -1
View File
@@ -153,7 +153,8 @@ static void redraw(unsigned cursor)
i++;
}
printf(ESC"[%u;%uH", 1 + cursor / 16, 1 + pos + (cursor & 0xf) * 3);
G.row = cursor / 16;
printf(ESC"[%u;%uH", 1 + G.row, 1 + pos + (cursor & 0xf) * 3);
}
static void redraw_cur_line(void)
@@ -367,6 +368,8 @@ int hexedit_main(int argc UNUSED_PARAM, char **argv)
if (G.current_byte > G.eof_byte) {
/* _after_ eof - don't allow this */
G.current_byte -= 16;
if (G.current_byte < G.baseaddr)
move_mapping_lower();
break;
}
}
+1
View File
@@ -1335,6 +1335,7 @@ However, in real world it was observed that some web servers
/* server.user remains untouched */
free(server.allocated);
server.allocated = NULL;
server.protocol = target.protocol;
server.host = target.host;
/* strip_ipv6_scope_id(target.host); - no! */
/* we assume remote never gives us IPv6 addr with scope id */
+50 -49
View File
@@ -169,9 +169,9 @@ typedef unsigned long long ullong;
* do not support more than 2^32 sectors
*/
typedef uint32_t sector_t;
#if UINT_MAX == 4294967295
#if UINT_MAX == 0xffffffff
# define SECT_FMT ""
#elif ULONG_MAX == 4294967295
#elif ULONG_MAX == 0xffffffff
# define SECT_FMT "l"
#else
# error Cant detect sizeof(uint32_t)
@@ -426,7 +426,7 @@ struct globals {
unsigned sector_offset; // = 1;
unsigned g_heads, g_sectors, g_cylinders;
smallint /* enum label_type */ current_label_type;
smallint display_in_cyl_units; // = 1;
smallint display_in_cyl_units;
#if ENABLE_FEATURE_OSF_LABEL
smallint possibly_osf_label;
#endif
@@ -488,7 +488,6 @@ struct globals {
sector_size = DEFAULT_SECTOR_SIZE; \
sector_offset = 1; \
g_partitions = 4; \
display_in_cyl_units = 1; \
units_per_sector = 1; \
dos_compatible_flag = 1; \
} while (0)
@@ -639,25 +638,6 @@ seek_sector(sector_t secno)
}
#if ENABLE_FEATURE_FDISK_WRITABLE
/* Read line; return 0 or first printable char */
static int
read_line(const char *prompt)
{
int sz;
sz = read_line_input(NULL, prompt, line_buffer, sizeof(line_buffer));
if (sz <= 0)
exit(EXIT_SUCCESS); /* Ctrl-D or Ctrl-C */
if (line_buffer[sz-1] == '\n')
line_buffer[--sz] = '\0';
line_ptr = line_buffer;
while (*line_ptr != '\0' && (unsigned char)*line_ptr <= ' ')
line_ptr++;
return *line_ptr;
}
static void
set_all_unchanged(void)
{
@@ -680,6 +660,25 @@ write_part_table_flag(char *b)
b[511] = 0xaa;
}
/* Read line; return 0 or first printable non-space char */
static int
read_line(const char *prompt)
{
int sz;
sz = read_line_input(NULL, prompt, line_buffer, sizeof(line_buffer));
if (sz <= 0)
exit(EXIT_SUCCESS); /* Ctrl-D or Ctrl-C */
if (line_buffer[sz-1] == '\n')
line_buffer[--sz] = '\0';
line_ptr = line_buffer;
while (*line_ptr != '\0' && (unsigned char)*line_ptr <= ' ')
line_ptr++;
return *line_ptr;
}
static char
read_nonempty(const char *mesg)
{
@@ -1614,53 +1613,54 @@ read_int(sector_t low, sector_t dflt, sector_t high, sector_t base, const char *
if (*line_ptr == '+' || *line_ptr == '-') {
int minus = (*line_ptr == '-');
int absolute = 0;
unsigned scale_shift;
value = atoi(line_ptr + 1);
if (sizeof(value) <= sizeof(long))
value = strtoul(line_ptr + 1, NULL, 10);
else
value = strtoull(line_ptr + 1, NULL, 10);
/* (1) if 2nd char is digit, use_default = 0.
* (2) move line_ptr to first non-digit. */
* (2) move line_ptr to first non-digit.
*/
while (isdigit(*++line_ptr))
use_default = 0;
switch (*line_ptr) {
case 'c':
case 'C':
if (!display_in_cyl_units)
value *= g_heads * g_sectors;
break;
case 'K':
absolute = 1024;
break;
scale_shift = 0;
switch (*line_ptr | 0x20) {
case 'k':
absolute = 1000;
scale_shift = 10; /* 1024 */
break;
case 'm':
case 'M':
absolute = 1000000;
scale_shift = 20; /* 1024*1024 */
break;
case 'g':
case 'G':
absolute = 1000000000;
scale_shift = 30; /* 1024*1024*1024 */
break;
case 't':
scale_shift = 40; /* 1024*1024*1024*1024 */
break;
default:
break;
}
if (absolute) {
if (scale_shift) {
ullong bytes;
unsigned long unit;
bytes = (ullong) value * absolute;
bytes = (ullong) value << scale_shift;
unit = sector_size * units_per_sector;
bytes += unit/2; /* round */
bytes /= unit;
value = bytes;
value = (bytes != 0 ? bytes - 1 : 0);
}
if (minus)
value = -value;
value += base;
} else {
value = atoi(line_ptr);
if (sizeof(value) <= sizeof(long))
value = strtoul(line_ptr, NULL, 10);
else
value = strtoull(line_ptr, NULL, 10);
while (isdigit(*line_ptr)) {
line_ptr++;
use_default = 0;
@@ -2526,8 +2526,9 @@ add_partition(int n, int sys)
stop = limit;
} else {
snprintf(mesg, sizeof(mesg),
"Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
"Last %s or +size{,K,M,G,T}",
str_units(SINGULAR)
);
stop = read_int(cround(start), cround(limit), cround(limit), cround(start), mesg);
if (display_in_cyl_units) {
stop = stop * units_per_sector - 1;
@@ -2611,9 +2612,9 @@ new_partition(void)
} else {
char c, line[80];
snprintf(line, sizeof(line),
"Command action\n"
" %s\n"
" p primary partition (1-4)\n",
"Partition type\n"
" p primary partition (1-4)\n"
" %s\n",
(extended_offset ?
"l logical (5 or over)" : "e extended"));
while (1) {
+1 -1
View File
@@ -623,7 +623,7 @@ sgi_change_sysid(int i, int sys)
"retrieve from its directory standalone tools like sash and fx.\n"
"Only the \"SGI volume\" entire disk section may violate this.\n"
"Type YES if you are sure about tagging this partition differently.\n");
if (strcmp(line_ptr, "YES\n") != 0)
if (strcmp(line_ptr, "YES") != 0)
return;
}
sgilabel->partitions[i].id = SGI_SSWAP32(sys);
+1 -1
View File
@@ -606,7 +606,7 @@ sun_change_sysid(int i, int sys)
"there may destroy your partition table and bootblock.\n"
"Type YES if you're very sure you would like that partition\n"
"tagged with 82 (Linux swap): ");
if (strcmp (line_ptr, "YES\n"))
if (strcmp(line_ptr, "YES") != 0)
return;
}
switch (sys) {