source: clfs-embedded/patches/busybox-1.13.2-branch_update-2.patch @ b36d112

Last change on this file since b36d112 was b36d112, checked in by Jim Gifford <clfs@…>, 15 years ago

Update to Busybox Branch Update Patch

  • Property mode set to 100644
File size: 10.6 KB
  • archival/tar.c

    Submitted By: Jim Gifford (jim at cross-lfs dot org)
    Date: 02-03-2009
    Initial Package Version: 1.13.2
    Origin: Upstream
    Upstream Status: Applied
    Description: This is a branch update for busybox-1.13.2, and should be
                 rechecked periodically.
    
    diff -Naur busybox-1.13.2.orig/archival/tar.c busybox-1.13.2/archival/tar.c
    old new  
    591591        struct TarBallInfo tbInfo;
    592592
    593593        tbInfo.hlInfoHead = NULL;
    594 
    595         fchmod(tar_fd, 0644);
    596594        tbInfo.tarFd = tar_fd;
    597595        tbInfo.verboseFlag = verboseFlag;
    598596
  • busybox-1.13.2

    diff -Naur busybox-1.13.2.orig/init/init.c busybox-1.13.2/init/init.c
    old new  
    671671 */
    672672static void parse_inittab(void)
    673673{
     674#if ENABLE_FEATURE_USE_INITTAB
    674675        char *token[4];
    675         /* order must correspond to SYSINIT..RESTART constants */
    676         static const char actions[] ALIGN1 =
    677                 "sysinit\0""respawn\0""askfirst\0""wait\0""once\0"
    678                 "ctrlaltdel\0""shutdown\0""restart\0";
    679 
    680         parser_t *parser = config_open2(INITTAB, fopen_for_read);
    681         /* No inittab file -- set up some default behavior */
    682         if (parser == NULL) {
     676        parser_t *parser = config_open2("/etc/inittab", fopen_for_read);
     677
     678        if (parser == NULL)
     679#endif
     680        {
     681                /* No inittab file -- set up some default behavior */
    683682                /* Reboot on Ctrl-Alt-Del */
    684683                new_init_action(CTRLALTDEL, "reboot", "");
    685684                /* Umount all filesystems on halt/reboot */
     
    699698                new_init_action(SYSINIT, INIT_SCRIPT, "");
    700699                return;
    701700        }
     701
     702#if ENABLE_FEATURE_USE_INITTAB
    702703        /* optional_tty:ignored_runlevel:action:command
    703704         * Delims are not to be collapsed and need exactly 4 tokens
    704705         */
    705706        while (config_read(parser, token, 4, 0, "#:",
    706707                                PARSE_NORMAL & ~(PARSE_TRIM | PARSE_COLLAPSE))) {
     708                /* order must correspond to SYSINIT..RESTART constants */
     709                static const char actions[] ALIGN1 =
     710                        "sysinit\0""respawn\0""askfirst\0""wait\0""once\0"
     711                        "ctrlaltdel\0""shutdown\0""restart\0";
    707712                int action;
    708713                char *tty = token[0];
    709714
     
    727732                                parser->lineno);
    728733        }
    729734        config_close(parser);
     735#endif
    730736}
    731737
    732738#if ENABLE_FEATURE_USE_INITTAB
  • modutils/depmod.c

    diff -Naur busybox-1.13.2.orig/modutils/depmod.c busybox-1.13.2/modutils/depmod.c
    old new  
    3333enum {
    3434        ARG_a = (1<<0), /* All modules, ignore mods in argv */
    3535        ARG_A = (1<<1), /* Only emit .ko that are newer than modules.dep file */
    36         ARG_b = (1<<2), /* not /lib/modules/$(uname -r)/ but this base-dir */
     36        ARG_b = (1<<2), /* base directory when modules are in staging area */
    3737        ARG_e = (1<<3), /* with -F, print unresolved symbols */
    3838        ARG_F = (1<<4), /* System.map that contains the symbols */
    3939        ARG_n = (1<<5)  /* dry-run, print to stdout only */
     
    5757        *first = info;
    5858
    5959        info->dnext = info->dprev = info;
    60         info->name = xstrdup(fname);
     60        info->name = xasprintf("/%s", fname);
    6161        info->modname = filename2modname(fname, NULL);
    6262        for (ptr = image; ptr < image + len - 10; ptr++) {
    6363                if (strncmp(ptr, "depends=", 8) == 0) {
     
    123123        }
    124124}
    125125
     126static void xfreopen_write(const char *file, FILE *f)
     127{
     128        if (freopen(file, "w", f) == NULL)
     129                bb_perror_msg_and_die("can't open '%s'", file);
     130}
     131
    126132int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    127133int depmod_main(int argc UNUSED_PARAM, char **argv)
    128134{
    129135        module_info *modules = NULL, *m, *dep;
    130         char *moddir_base = (char *)CONFIG_DEFAULT_MODULES_DIR;
     136        const char *moddir_base = "/";
     137        char *moddir, *version;
     138        struct utsname uts;
    131139        int tmp;
    132140
    133141        getopt32(argv, "aAb:eF:n", &moddir_base, NULL);
    134142        argv += optind;
    135143
    136144        /* goto modules location */
     145        xchdir(moddir_base);
    137146
    138147        /* If a version is provided, then that kernel version's module directory
    139148         * is used, rather than the current kernel version (as returned by
    140149         * "uname -r").  */
    141         xchdir(moddir_base);
    142         if (*argv && (sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3)) {
    143                 xchdir(*argv++);
     150        if (*argv && sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3) {
     151                version = *argv++;
    144152        } else {
    145                 struct utsname uts;
    146153                uname(&uts);
    147                 xchdir(uts.release);
     154                version = uts.release;
    148155        }
    149         /* If no modules are given on the command-line, -a is on per default.  */
    150         option_mask32 |= *argv == NULL;
     156        moddir = concat_path_file(&CONFIG_DEFAULT_MODULES_DIR[1], version);
    151157
    152158        /* Scan modules */
    153         moddir_base = xrealloc_getcwd_or_warn(NULL);
    154         do {
    155                 recursive_action((option_mask32 & ARG_a) ? moddir_base : *argv,
    156                                 ACTION_RECURSE, parse_module, NULL,  &modules, 0);
    157         } while (!(option_mask32 & ARG_a) && *(++argv));
     159        if (*argv) {
     160                char *modfile;
     161                struct stat sb;
     162                do {
     163                        modfile = concat_path_file(moddir, *argv);
     164                        xstat(modfile, &sb);
     165                        parse_module(modfile, &sb, &modules, 0);
     166                        free(modfile);
     167                } while (*(++argv));
     168        } else {
     169                recursive_action(moddir, ACTION_RECURSE,
     170                                 parse_module, NULL, &modules, 0);
     171        }
     172
     173        /* Prepare for writing out the dep files */
     174        xchdir(moddir);
    158175        if (ENABLE_FEATURE_CLEAN_UP)
    159                 free(moddir_base);
     176                free(moddir);
    160177
    161178        /* Generate dependency and alias files */
    162179        if (!(option_mask32 & ARG_n))
    163                 freopen(CONFIG_DEFAULT_DEPMOD_FILE, "w", stdout);
     180                xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout);
    164181        for (m = modules; m != NULL; m = m->next) {
    165182                printf("%s:", m->name);
    166183
     
    174191                        dep->dprev->dnext = dep->dnext;
    175192                        dep->dnext = dep->dprev = dep;
    176193                }
    177                 puts("");
     194                bb_putchar('\n');
    178195        }
    179196
    180197#if ENABLE_FEATURE_MODUTILS_ALIAS
    181198        if (!(option_mask32 & ARG_n))
    182                 freopen("modules.alias", "w", stdout);
     199                xfreopen_write("modules.alias", stdout);
    183200        for (m = modules; m != NULL; m = m->next) {
    184201                while (m->aliases) {
    185202                        printf("alias %s %s\n",
     
    190207#endif
    191208#if ENABLE_FEATURE_MODUTILS_SYMBOLS
    192209        if (!(option_mask32 & ARG_n))
    193                 freopen("modules.symbols", "w", stdout);
     210                xfreopen_write("modules.symbols", stdout);
    194211        for (m = modules; m != NULL; m = m->next) {
    195212                while (m->symbols) {
    196213                        printf("alias symbol:%s %s\n",
  • modutils/modutils-24.c

    diff -Naur busybox-1.13.2.orig/modutils/modutils-24.c busybox-1.13.2/modutils/modutils-24.c
    old new  
    21502150        sec->name = name;
    21512151        sec->idx = newidx;
    21522152        if (size)
    2153                 sec->contents = xmalloc(size);
     2153                sec->contents = xzalloc(size);
    21542154
    21552155        obj_insert_section_load_order(f, sec);
    21562156
     
    21652165        int newidx = f->header.e_shnum++;
    21662166        struct obj_section *sec;
    21672167
    2168         f->sections = xrealloc(f->sections, (newidx + 1) * sizeof(sec));
     2168        f->sections = xrealloc_vector(f->sections, 2, newidx);
    21692169        f->sections[newidx] = sec = arch_new_section();
    21702170
    21712171        sec->header.sh_type = SHT_PROGBITS;
     
    21752175        sec->name = name;
    21762176        sec->idx = newidx;
    21772177        if (size)
    2178                 sec->contents = xmalloc(size);
     2178                sec->contents = xzalloc(size);
    21792179
    21802180        sec->load_next = f->load_order;
    21812181        f->load_order = sec;
     
    25712571        /* Collect the modules' symbols.  */
    25722572
    25732573        if (nmod) {
    2574                 ext_modules = modules = xmalloc(nmod * sizeof(*modules));
    2575                 memset(modules, 0, nmod * sizeof(*modules));
     2574                ext_modules = modules = xzalloc(nmod * sizeof(*modules));
    25762575                for (i = 0, mn = module_names, m = modules;
    25772576                                i < nmod; ++i, ++m, mn += strlen(mn) + 1) {
    25782577                        struct new_module_info info;
     
    26522651}
    26532652
    26542653
    2655 static void  new_create_this_module(struct obj_file *f, const char *m_name)
     2654static void new_create_this_module(struct obj_file *f, const char *m_name)
    26562655{
    26572656        struct obj_section *sec;
    26582657
    26592658        sec = obj_create_alloced_section_first(f, ".this", tgt_sizeof_long,
    26602659                        sizeof(struct new_module));
    2661         memset(sec->contents, 0, sizeof(struct new_module));
     2660        /* done by obj_create_alloced_section_first: */
     2661        /*memset(sec->contents, 0, sizeof(struct new_module));*/
    26622662
    26632663        obj_add_symbol(f, SPFX "__this_module", -1,
    26642664                        ELF_ST_INFO(STB_LOCAL, STT_OBJECT), sec->idx, 0,
     
    29652965                if (i == f->header.e_shnum) {
    29662966                        struct obj_section *sec;
    29672967
     2968                        f->header.e_shnum++;
    29682969                        f->sections = xrealloc_vector(f->sections, 2, i);
    29692970                        f->sections[i] = sec = arch_new_section();
    2970                         f->header.e_shnum = i + 1;
    29712971
    29722972                        sec->header.sh_type = SHT_PROGBITS;
    29732973                        sec->header.sh_flags = SHF_WRITE | SHF_ALLOC;
     
    30063006        for (i = 0; i < f->header.e_shnum; ++i) {
    30073007                struct obj_section *s = f->sections[i];
    30083008                if (s->header.sh_type == SHT_NOBITS) {
     3009                        s->contents = NULL;
    30093010                        if (s->header.sh_size != 0)
    3010                                 s->contents = memset(xmalloc(s->header.sh_size),
    3011                                                 0, s->header.sh_size);
    3012                         else
    3013                                 s->contents = NULL;
    3014 
     3011                                s->contents = xzalloc(s->header.sh_size);
    30153012                        s->header.sh_type = SHT_PROGBITS;
    30163013                }
    30173014        }
     
    32753272                        case SHT_SYMTAB:
    32763273                        case SHT_STRTAB:
    32773274                        case SHT_RELM:
     3275                                sec->contents = NULL;
    32783276                                if (sec->header.sh_size > 0) {
    3279                                         sec->contents = xmalloc(sec->header.sh_size);
     3277                                        sec->contents = xzalloc(sec->header.sh_size);
    32803278                                        fseek(fp, sec->header.sh_offset, SEEK_SET);
    32813279                                        if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
    32823280                                                bb_perror_msg_and_die("error reading ELF section data");
    32833281                                        }
    3284                                 } else {
    3285                                         sec->contents = NULL;
    32863282                                }
    32873283                                break;
    32883284
  • testsuite/mdev.tests

    diff -Naur busybox-1.13.2.orig/testsuite/mdev.tests busybox-1.13.2/testsuite/mdev.tests
    old new  
    111111
    112112# continuing to use directory structure from prev test
    113113rm -rf mdev.testdir/dev/*
     114echo "sda 0:0 644 =block/ @echo @echo TEST" >mdev.testdir/etc/mdev.conf
     115testing "mdev move and command" \
     116        "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
     117        ls -lnR mdev.testdir/dev | $FILTER_LS2" \
     118"\
     119@echo TEST
     120mdev.testdir/dev:
     121drwxr-xr-x 2 0 0 block
     122
     123mdev.testdir/dev/block:
     124brw-r--r-- 1 0 0 sda
     125" \
     126        "" ""
     127
     128# continuing to use directory structure from prev test
     129rm -rf mdev.testdir/dev/*
    114130echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf
    115131testing "mdev #maj,min and no explicit uid" \
    116132        "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
  • util-linux/mdev.c

    diff -Naur busybox-1.13.2.orig/util-linux/mdev.c busybox-1.13.2/util-linux/mdev.c
    old new  
    179179                        unsigned i, n;
    180180#endif
    181181                        char *a = val;
    182                         s = strchr(val, ' ');
    183                         val = (s && s[1]) ? s+1 : NULL;
     182                        s = strchrnul(val, ' ');
     183                        val = (s[0] && s[1]) ? s+1 : NULL;
     184                        s[0] = '\0';
    184185#if ENABLE_FEATURE_MDEV_RENAME_REGEXP
    185186                        /* substitute %1..9 with off[1..9], if any */
    186187                        n = 0;
Note: See TracBrowser for help on using the repository browser.