Ignore:
Timestamp:
Oct 25, 2006, 1:51:57 AM (13 years ago)
Author:
bruno
Message:

merge -r890:902 $SVN_M/branches/stable

Location:
trunk/mindi-busybox/util-linux
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/mindi-busybox/util-linux/mdev.c

    r821 r904  
    4141     * also depend on path having writeable space after it. */
    4242
    43     strcat(path, "/dev");
    44     fd = open(path, O_RDONLY);
    45     len = read(fd, temp + 1, 64);
    46     *temp++ = 0;
    47     close(fd);
    48     if (len < 1) return;
     43    if (!delete) {
     44        strcat(path, "/dev");
     45        fd = open(path, O_RDONLY);
     46        len = read(fd, temp + 1, 64);
     47        *temp++ = 0;
     48        close(fd);
     49        if (len < 1) return;
     50    }
    4951
    5052    /* Determine device name, type, major and minor */
     
    5254    device_name = strrchr(path, '/') + 1;
    5355    type = path[5]=='c' ? S_IFCHR : S_IFBLK;
    54     if (sscanf(temp, "%d:%d", &major, &minor) != 2) return;
    5556
    5657    /* If we have a config file, look up permissions for this device */
     
    168169    umask(0);
    169170    if (!delete) {
     171        if (sscanf(temp, "%d:%d", &major, &minor) != 2) return;
    170172        if (mknod(device_name, mode | type, makedev(major, minor)) && errno != EEXIST)
    171173            bb_perror_msg_and_die("mknod %s failed", device_name);
  • trunk/mindi-busybox/util-linux/mount.c

    r821 r904  
    292292    // a synthetic filesystem like proc or sysfs.)
    293293
    294     if (lstat(mp->mnt_fsname, &st));
     294    if (stat(mp->mnt_fsname, &st));
    295295    else if (!(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) {
    296296        // Do we need to allocate a loopback device for it?
  • trunk/mindi-busybox/util-linux/readprofile.c

    r821 r904  
    6868    const char *mapFile, *proFile, *mult=0;
    6969    unsigned long len=0, indx=1;
    70     unsigned long long add0=0;
     70    uint64_t add0=0;
    7171    unsigned int step;
    7272    unsigned int *buf, total, fn_len;
     
    244244                    header_printed = 1;
    245245                }
    246                 printf ("\t%llx\t%u\n", (indx - 1)*step + add0, buf[indx]);
     246                printf ("\t%"PRIx64"\t%u\n", (indx - 1)*step + add0, buf[indx]);
    247247            }
    248248            this += buf[indx++];
  • trunk/mindi-busybox/util-linux/umount.c

    r821 r904  
    1515#include <mntent.h>
    1616#include <errno.h>
    17 #include <string.h>
    1817#include <getopt.h>
    1918
    20 #define OPTION_STRING       "flDnrvad"
     19#define OPTION_STRING       "flDnravd"
    2120#define OPT_FORCE           1
    2221#define OPT_LAZY            2
     
    2423#define OPT_NO_MTAB         8
    2524#define OPT_REMOUNT         16
    26 #define OPT_IGNORED         32  // -v is ignored
    27 #define OPT_ALL             (ENABLE_FEATURE_UMOUNT_ALL ? 64 : 0)
     25#define OPT_ALL             (ENABLE_FEATURE_UMOUNT_ALL ? 32 : 0)
    2826
    2927int umount_main(int argc, char **argv)
     
    7876        if (!argc) bb_show_usage();
    7977    }
    80 
    81 
    8278   
    8379    // Loop through everything we're supposed to umount, and do so.
    8480    for (;;) {
    8581        int curstat;
     82        char *zapit = *argv;
    8683
    8784        // Do we already know what to umount this time through the loop?
     
    9289        else if (!argc--) break;
    9390        else {
    94             realpath(*argv++, path);
     91            argv++;
     92            realpath(zapit, path);
    9593            for (m = mtl; m; m = m->next)
    9694                if (!strcmp(path, m->dir) || !strcmp(path, m->device))
    9795                    break;
    9896        }
     97        // If we couldn't find this sucker in /etc/mtab, punt by passing our
     98        // command line argument straight to the umount syscall.  Otherwise,
     99        // umount the directory even if we were given the block device.
     100        if (m) zapit = m->dir;
    99101
    100102        // Let's ask the thing nicely to unmount.
    101         curstat = umount(path);
     103        curstat = umount(zapit);
    102104
    103105        // Force the unmount, if necessary.
    104106        if (curstat && doForce) {
    105             curstat = umount2(path, doForce);
     107            curstat = umount2(zapit, doForce);
    106108            if (curstat)
    107                 bb_error_msg_and_die("forced umount of %s failed!", path);
     109                bb_error_msg_and_die("forced umount of %s failed!", zapit);
    108110        }
    109111
    110112        // If still can't umount, maybe remount read-only?
    111113        if (curstat && (opt & OPT_REMOUNT) && errno == EBUSY && m) {
    112             curstat = mount(m->device, path, NULL, MS_REMOUNT|MS_RDONLY, NULL);
     114            curstat = mount(m->device, zapit, NULL, MS_REMOUNT|MS_RDONLY, NULL);
    113115            bb_error_msg(curstat ? "Cannot remount %s read-only" :
    114116                         "%s busy - remounted read-only", m->device);
    115117        }
    116118
    117         /* De-allocate the loop device.  This ioctl should be ignored on any
    118          * non-loop block devices. */
    119         if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONTFREELOOP) && m)
    120             del_loop(m->device);
     119        if (curstat) {
     120            status = EXIT_FAILURE;
     121            bb_perror_msg("Couldn't umount %s", zapit);
     122        } else {
     123            /* De-allocate the loop device.  This ioctl should be ignored on
     124             * any non-loop block devices. */
     125            if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONTFREELOOP) && m)
     126                del_loop(m->device);
     127            if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m)
     128                erase_mtab(m->dir);
     129        }
    121130
    122         if (curstat) {
    123             /* Yes, the ENABLE is redundant here, but the optimizer for ARM
    124              * can't do simple constant propagation in local variables... */
    125             if(ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m)
    126                 erase_mtab(m->dir);
    127             status = EXIT_FAILURE;
    128             bb_perror_msg("Couldn't umount %s", path);
    129         }
    130131        // Find next matching mtab entry for -a or umount /dev
     132        // Note this means that "umount /dev/blah" will unmount all instances
     133        // of /dev/blah, not just the most recent.
    131134        while (m && (m = m->next))
    132135            if ((opt & OPT_ALL) || !strcmp(path,m->device))
Note: See TracChangeset for help on using the changeset viewer.