Changeset 2859 in MondoRescue for branches/2.2.9


Ignore:
Timestamp:
Jul 26, 2011, 1:25:42 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update to upstream busybox 1.18.5
Location:
branches/2.2.9/mindi-busybox
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/Config.in

    r2725 r2859  
    127127    bool "Don't use /usr"
    128128    default n
    129     depends on FEATURE_INSTALLER
    130129    help
    131130      Disable use of /usr. busybox --install and "make install"
  • branches/2.2.9/mindi-busybox/Makefile

    r2823 r2859  
    11VERSION = 1
    22PATCHLEVEL = 18
    3 SUBLEVEL = 3
     3SUBLEVEL = 5
    44EXTRAVERSION = -rPBREV
    55NAME = Unnamed
  • branches/2.2.9/mindi-busybox/coreutils/cksum.c

    r2725 r2859  
    3939#define read_buf bb_common_bufsiz1
    4040        while ((bytes_read = safe_read(fd, read_buf, sizeof(read_buf))) > 0) {
     41            length += bytes_read;
    4142            crc = crc32_block_endian1(crc, read_buf, bytes_read, crc32_table);
    4243        }
  • branches/2.2.9/mindi-busybox/modutils/modutils-24.c

    r2725 r2859  
    24752475        p = val;
    24762476        while (*p != 0) {
     2477            char sv_ch;
    24772478            char *endp;
    24782479
     
    24832484            case 's':
    24842485                len = strcspn(p, ",");
     2486                sv_ch = p[len];
    24852487                p[len] = 0;
    24862488                obj_string_patch(f, sym->secidx,
     
    24882490                loc += tgt_sizeof_char_p;
    24892491                p += len;
     2492                *p = sv_ch;
    24902493                break;
    24912494            case 'c':
    24922495                len = strcspn(p, ",");
     2496                sv_ch = p[len];
    24932497                p[len] = 0;
    24942498                if (len >= charssize)
     
    24982502                loc += charssize;
    24992503                p += len;
     2504                *p = sv_ch;
    25002505                break;
    25012506            case 'b':
  • branches/2.2.9/mindi-busybox/networking/wget.c

    r2725 r2859  
    447447static void NOINLINE retrieve_file_data(FILE *dfp, int output_fd)
    448448{
    449     char buf[512];
     449    char buf[4*1024]; /* made bigger to speed up local xfers */
    450450#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
    451451# if ENABLE_FEATURE_WGET_TIMEOUT
     
    456456    polldata.fd = fileno(dfp);
    457457    polldata.events = POLLIN | POLLPRI;
    458     ndelay_on(polldata.fd);
    459458#endif
    460459    progress_meter(PROGRESS_START);
     
    465464    /* Loops only if chunked */
    466465    while (1) {
     466
     467#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
     468        ndelay_on(polldata.fd);
     469#endif
    467470        while (1) {
    468471            int n;
     
    494497            }
    495498#endif
     499            /* fread internally uses read loop, which in our case
     500             * is usually exited when we get EAGAIN.
     501             * In this case, libc sets error marker on the stream.
     502             * Need to clear it before next fread to avoid possible
     503             * rare false positive ferror below. Rare because usually
     504             * fread gets more than zero bytes, and we don't fall
     505             * into if (n <= 0) ...
     506             */
     507            clearerr(dfp);
     508            errno = 0;
    496509            n = safe_fread(buf, rdsz, dfp);
     510            /* man fread:
     511             * If error occurs, or EOF is reached, the return value
     512             * is a short item count (or zero).
     513             * fread does not distinguish between EOF and error.
     514             */
    497515            if (n <= 0) {
    498                 if (ferror(dfp)) {
    499                     /* perror will not work: ferror doesn't set errno */
    500                     bb_error_msg_and_die(bb_msg_read_error);
    501                 }
    502                 break;
     516#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
     517                if (errno == EAGAIN) /* poll lied, there is no data? */
     518                    continue; /* yes */
     519#endif
     520                if (ferror(dfp))
     521                    bb_perror_msg_and_die(bb_msg_read_error);
     522                break; /* EOF, not error */
    503523            }
     524
    504525            xwrite(output_fd, buf, n);
    505526#if ENABLE_FEATURE_WGET_STATUSBAR
     
    507528            progress_meter(PROGRESS_BUMP);
    508529#endif
    509             if (G.got_clen)
     530            if (G.got_clen) {
    510531                G.content_len -= n;
    511         }
     532                if (G.content_len == 0)
     533                    break;
     534            }
     535        }
     536#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
     537        ndelay_off(polldata.fd);
     538#endif
    512539
    513540        if (!G.chunked)
     
    707734            target.host, user_agent);
    708735
     736        /* Ask server to close the connection as soon as we are done
     737         * (IOW: we do not intend to send more requests)
     738         */
     739        fprintf(sfp, "Connection: close\r\n");
     740
    709741#if ENABLE_FEATURE_WGET_AUTHENTICATION
    710742        if (target.user) {
     
    720752        if (G.beg_range)
    721753            fprintf(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range);
     754
    722755#if ENABLE_FEATURE_WGET_LONG_OPTIONS
    723756        if (extra_headers)
     
    726759        if (opt & WGET_OPT_POST_DATA) {
    727760            char *estr = URL_escape(post_data);
    728             fprintf(sfp, "Content-Type: application/x-www-form-urlencoded\r\n");
    729             fprintf(sfp, "Content-Length: %u\r\n" "\r\n" "%s",
    730                     (int) strlen(estr), estr);
    731             /*fprintf(sfp, "Connection: Keep-Alive\r\n\r\n");*/
    732             /*fprintf(sfp, "%s\r\n", estr);*/
     761            fprintf(sfp,
     762                "Content-Type: application/x-www-form-urlencoded\r\n"
     763                "Content-Length: %u\r\n"
     764                "\r\n"
     765                "%s",
     766                (int) strlen(estr), estr
     767            );
    733768            free(estr);
    734769        } else
    735770#endif
    736         { /* If "Connection:" is needed, document why */
    737             fprintf(sfp, /* "Connection: close\r\n" */ "\r\n");
     771        {
     772            fprintf(sfp, "\r\n");
    738773        }
    739774
  • branches/2.2.9/mindi-busybox/procps/fuser.c

    r2725 r2859  
    272272            goto file;
    273273        sprintf(path, "/proc/net/%s", tproto);
    274         if (access(path, R_OK) != 0) { /* PORT/PROTO */
     274        if (access(path, R_OK) == 0) { /* PORT/PROTO */
    275275            scan_proc_net(path, port);
    276276        } else { /* FILE */
  • branches/2.2.9/mindi-busybox/scripts/kconfig/mconf.c

    r2725 r2859  
    257257    "\n");
    258258
    259 static char buf[4096], *bufptr = buf;
     259static char buf[4096*10], *bufptr = buf;
    260260static char input_buf[4096];
    261261static const char filename[] = ".config";
  • branches/2.2.9/mindi-busybox/scripts/mkconfigs

    r2725 r2859  
    4343static const char bbconfig_config[] ALIGN1 ="
    4444
    45 grep '^#\? \?CONFIG_' "$config" \
     45grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
    4646| sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'
    4747
     
    6464static const char bbconfig_config_bz2[] ALIGN1 = {"
    6565
    66 grep '^#\? \?CONFIG_' "$config" \
     66grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
    6767| bzip2 -1 | dd bs=2 skip=1 2>/dev/null \
    6868| od -v -t x1 \
  • branches/2.2.9/mindi-busybox/shell/hush.c

    r2725 r2859  
    428428#define NULL_O_STRING { NULL }
    429429
     430#ifndef debug_printf_parse
     431static const char *const assignment_flag[] = {
     432    "MAYBE_ASSIGNMENT",
     433    "DEFINITELY_ASSIGNMENT",
     434    "NOT_ASSIGNMENT",
     435    "WORD_IS_KEYWORD",
     436};
     437#endif
     438
    430439/* I can almost use ordinary FILE*.  Is open_memstream() universally
    431440 * available?  Where is it documented? */
     
    28862895    static const struct reserved_combo reserved_list[] = {
    28872896# if ENABLE_HUSH_IF
    2888         { "!",     RES_NONE,  NOT_ASSIGNMENT , 0 },
    2889         { "if",    RES_IF,    WORD_IS_KEYWORD, FLAG_THEN | FLAG_START },
    2890         { "then",  RES_THEN,  WORD_IS_KEYWORD, FLAG_ELIF | FLAG_ELSE | FLAG_FI },
    2891         { "elif",  RES_ELIF,  WORD_IS_KEYWORD, FLAG_THEN },
    2892         { "else",  RES_ELSE,  WORD_IS_KEYWORD, FLAG_FI   },
    2893         { "fi",    RES_FI,    NOT_ASSIGNMENT , FLAG_END  },
     2897        { "!",     RES_NONE,  NOT_ASSIGNMENT  , 0 },
     2898        { "if",    RES_IF,    MAYBE_ASSIGNMENT, FLAG_THEN | FLAG_START },
     2899        { "then",  RES_THEN,  MAYBE_ASSIGNMENT, FLAG_ELIF | FLAG_ELSE | FLAG_FI },
     2900        { "elif",  RES_ELIF,  MAYBE_ASSIGNMENT, FLAG_THEN },
     2901        { "else",  RES_ELSE,  MAYBE_ASSIGNMENT, FLAG_FI   },
     2902        { "fi",    RES_FI,    NOT_ASSIGNMENT  , FLAG_END  },
    28942903# endif
    28952904# if ENABLE_HUSH_LOOPS
    2896         { "for",   RES_FOR,   NOT_ASSIGNMENT , FLAG_IN | FLAG_DO | FLAG_START },
    2897         { "while", RES_WHILE, WORD_IS_KEYWORD, FLAG_DO | FLAG_START },
    2898         { "until", RES_UNTIL, WORD_IS_KEYWORD, FLAG_DO | FLAG_START },
    2899         { "in",    RES_IN,    NOT_ASSIGNMENT , FLAG_DO   },
    2900         { "do",    RES_DO,    WORD_IS_KEYWORD, FLAG_DONE },
    2901         { "done",  RES_DONE,  NOT_ASSIGNMENT , FLAG_END  },
     2905        { "for",   RES_FOR,   NOT_ASSIGNMENT  , FLAG_IN | FLAG_DO | FLAG_START },
     2906        { "while", RES_WHILE, MAYBE_ASSIGNMENT, FLAG_DO | FLAG_START },
     2907        { "until", RES_UNTIL, MAYBE_ASSIGNMENT, FLAG_DO | FLAG_START },
     2908        { "in",    RES_IN,    NOT_ASSIGNMENT  , FLAG_DO   },
     2909        { "do",    RES_DO,    MAYBE_ASSIGNMENT, FLAG_DONE },
     2910        { "done",  RES_DONE,  NOT_ASSIGNMENT  , FLAG_END  },
    29022911# endif
    29032912# if ENABLE_HUSH_CASE
    2904         { "case",  RES_CASE,  NOT_ASSIGNMENT , FLAG_MATCH | FLAG_START },
    2905         { "esac",  RES_ESAC,  NOT_ASSIGNMENT , FLAG_END  },
     2913        { "case",  RES_CASE,  NOT_ASSIGNMENT  , FLAG_MATCH | FLAG_START },
     2914        { "esac",  RES_ESAC,  NOT_ASSIGNMENT  , FLAG_END  },
    29062915# endif
    29072916    };
     
    29692978    ctx->old_flag = r->flag;
    29702979    word->o_assignment = r->assignment_flag;
     2980    debug_printf_parse("word->o_assignment='%s'\n", assignment_flag[word->o_assignment]);
    29712981
    29722982    if (ctx->old_flag & FLAG_END) {
     
    30353045        ctx->pending_redirect = NULL;
    30363046    } else {
    3037         /* If this word wasn't an assignment, next ones definitely
    3038          * can't be assignments. Even if they look like ones. */
    3039         if (word->o_assignment != DEFINITELY_ASSIGNMENT
    3040          && word->o_assignment != WORD_IS_KEYWORD
    3041         ) {
    3042             word->o_assignment = NOT_ASSIGNMENT;
    3043         } else {
    3044             if (word->o_assignment == DEFINITELY_ASSIGNMENT)
    3045                 command->assignment_cnt++;
    3046             word->o_assignment = MAYBE_ASSIGNMENT;
    3047         }
    3048 
    30493047#if HAS_KEYWORDS
    30503048# if ENABLE_HUSH_CASE
     
    30663064# endif
    30673065        ) {
    3068             debug_printf_parse("checking '%s' for reserved-ness\n", word->data);
    3069             if (reserved_word(word, ctx)) {
     3066            int reserved = reserved_word(word, ctx);
     3067            debug_printf_parse("checking for reserved-ness: %d\n", reserved);
     3068            if (reserved) {
    30703069                o_reset_to_empty_unquoted(word);
    30713070                debug_printf_parse("done_word return %d\n",
     
    30883087            return 1;
    30893088        }
     3089
     3090        /* If this word wasn't an assignment, next ones definitely
     3091         * can't be assignments. Even if they look like ones. */
     3092        if (word->o_assignment != DEFINITELY_ASSIGNMENT
     3093         && word->o_assignment != WORD_IS_KEYWORD
     3094        ) {
     3095            word->o_assignment = NOT_ASSIGNMENT;
     3096        } else {
     3097            if (word->o_assignment == DEFINITELY_ASSIGNMENT) {
     3098                command->assignment_cnt++;
     3099                debug_printf_parse("++assignment_cnt=%d\n", command->assignment_cnt);
     3100            }
     3101            debug_printf_parse("word->o_assignment was:'%s'\n", assignment_flag[word->o_assignment]);
     3102            word->o_assignment = MAYBE_ASSIGNMENT;
     3103        }
     3104        debug_printf_parse("word->o_assignment='%s'\n", assignment_flag[word->o_assignment]);
     3105
    30903106        if (word->has_quoted_part
    30913107         /* optimization: and if it's ("" or '') or ($v... or `cmd`...): */
     
    41064122            ) {
    41074123                dest.o_assignment = DEFINITELY_ASSIGNMENT;
     4124                debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]);
    41084125            }
    41094126            continue;
     
    41554172                }
    41564173                dest.o_assignment = MAYBE_ASSIGNMENT;
     4174                debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]);
    41574175                ch = ';';
    41584176                /* note: if (is_blank) continue;
     
    42044222            done_pipe(&ctx, PIPE_SEQ);
    42054223            dest.o_assignment = MAYBE_ASSIGNMENT;
     4224            debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]);
    42064225            /* Do we sit outside of any if's, loops or case's? */
    42074226            if (!HAS_KEYWORDS
     
    43104329             * cannot be an assignment */
    43114330            dest.o_assignment = NOT_ASSIGNMENT;
     4331            debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]);
    43124332        }
    43134333
     
    44074427             * with an assignment */
    44084428            dest.o_assignment = MAYBE_ASSIGNMENT;
     4429            debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]);
    44094430            break;
    44104431        case '&':
     
    72937314#if ENABLE_HUSH_LOOPS
    72947315        /* Beware of "while false; true; do ..."! */
    7295         if (pi->next && pi->next->res_word == RES_DO) {
     7316        if (pi->next
     7317         && (pi->next->res_word == RES_DO || pi->next->res_word == RES_DONE)
     7318        /* (the second check above is needed for "while ...; do \n done" case) */
     7319        ) {
    72967320            if (rword == RES_WHILE) {
    72977321                if (rcode) {
  • branches/2.2.9/mindi-busybox/sysklogd/klogd.c

    r2725 r2859  
    151151    klogd_open();
    152152    openlog("kernel", 0, LOG_KERN);
     153    /*
     154     * glibc problem: for some reason, glibc changes LOG_KERN to LOG_USER
     155     * above. The logic behind this is that standard
     156     * http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html
     157     * says the following about openlog and syslog:
     158     * "LOG_USER
     159     *  Messages generated by arbitrary processes.
     160     *  This is the default facility identifier if none is specified."
     161     *
     162     * I believe glibc misinterpreted this text as "if openlog's
     163     * third parameter is 0 (=LOG_KERN), treat it as LOG_USER".
     164     * Whereas it was meant to say "if *syslog* is called with facility
     165     * 0 in its 1st parameter without prior call to openlog, then perform
     166     * implicit openlog(LOG_USER)".
     167     *
     168     * As a result of this, eh, feature, standard klogd was forced
     169     * to open-code its own openlog and syslog implementation (!).
     170     *
     171     * Note that prohibiting openlog(LOG_KERN) on libc level does not
     172     * add any security: any process can open a socket to "/dev/log"
     173     * and write a string "<0>Voila, a LOG_KERN + LOG_EMERG message"
     174     *
     175     * Google code search tells me there is no widespread use of
     176     * openlog("foo", 0, 0), thus fixing glibc won't break userspace.
     177     *
     178     * The bug against glibc was filed:
     179     * bugzilla.redhat.com/show_bug.cgi?id=547000
     180     */
    153181
    154182    if (i)
    155183        klogd_setloglevel(i);
    156184
    157     bb_signals(BB_FATAL_SIGS, record_signo);
    158185    signal(SIGHUP, SIG_IGN);
     186    /* We want klogd_read to not be restarted, thus _norestart: */
     187    bb_signals_recursive_norestart(BB_FATAL_SIGS, record_signo);
    159188
    160189    syslog(LOG_NOTICE, "klogd started: %s", bb_banner);
Note: See TracChangeset for help on using the changeset viewer.