Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/coreutils/mknod.c

    r1765 r2725  
    55 * Copyright (C) 2003  Manuel Novoa III  <mjn3@codepoet.org>
    66 *
    7  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
    99
     
    1515#include "libcoreutils/coreutils.h"
    1616
     17/* This is a NOEXEC applet. Be very careful! */
     18
    1719static const char modes_chars[] ALIGN1 = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 };
    1820static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK };
    1921
    20 int mknod_main(int argc, char **argv);
     22int mknod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    2123int mknod_main(int argc, char **argv)
    2224{
     
    2527    const char *name;
    2628
    27     mode = getopt_mk_fifo_nod(argc, argv);
     29    mode = getopt_mk_fifo_nod(argv);
    2830    argv += optind;
    2931    argc -= optind;
    3032
    31     if ((argc >= 2) && ((name = strchr(modes_chars, argv[1][0])) != NULL)) {
    32         mode |= modes_cubp[(int)(name[4])];
     33    if (argc >= 2) {
     34        name = strchr(modes_chars, argv[1][0]);
     35        if (name != NULL) {
     36            mode |= modes_cubp[(int)(name[4])];
    3337
    34         dev = 0;
    35         if ((*name != 'p') && ((argc -= 2) == 2)) {
    36             /* Autodetect what the system supports; these macros should
    37              * optimize out to two constants. */
    38             dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)),
    39                           xatoul_range(argv[3], 0, minor(UINT_MAX)));
    40         }
     38            dev = 0;
     39            if (*name != 'p') {
     40                argc -= 2;
     41                if (argc == 2) {
     42                    /* Autodetect what the system supports; these macros should
     43                     * optimize out to two constants. */
     44                    dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)),
     45                                  xatoul_range(argv[3], 0, minor(UINT_MAX)));
     46                }
     47            }
    4148
    42         if (argc == 2) {
    43             name = *argv;
    44             if (mknod(name, mode, dev) == 0) {
    45                 return EXIT_SUCCESS;
     49            if (argc == 2) {
     50                name = *argv;
     51                if (mknod(name, mode, dev) == 0) {
     52                    return EXIT_SUCCESS;
     53                }
     54                bb_simple_perror_msg_and_die(name);
    4655            }
    47             bb_perror_msg_and_die("%s", name);
    4856        }
    4957    }
Note: See TracChangeset for help on using the changeset viewer.