Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/util-linux/umount.c

    r3232 r3621  
    3131#include <mntent.h>
    3232#include <sys/mount.h>
     33#ifndef MNT_DETACH
     34# define MNT_DETACH 0x00000002
     35#endif
    3336#include "libbb.h"
     37#include "common_bufsiz.h"
    3438
    3539#if defined(__dietlibc__)
     
    8286
    8387    // MNT_FORCE and MNT_DETACH (from linux/fs.h) must match
    84     // OPT_FORCE and OPT_LAZY, otherwise this trick won't work:
    85     doForce = MAX((opt & OPT_FORCE), (opt & OPT_LAZY));
     88    // OPT_FORCE and OPT_LAZY.
     89    BUILD_BUG_ON(OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH);
     90    doForce = opt & (OPT_FORCE|OPT_LAZY);
    8691
    8792    /* Get a list of mount points from mtab.  We read them all in now mostly
     
    99104            bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file);
    100105    } else {
    101         while (getmntent_r(fp, &me, bb_common_bufsiz1, sizeof(bb_common_bufsiz1))) {
     106        setup_common_bufsiz();
     107        while (getmntent_r(fp, &me, bb_common_bufsiz1, COMMON_BUFSIZE)) {
    102108            /* Match fstype if passed */
    103109            if (!match_fstype(&me, fstype))
     
    148154        if (m) zapit = m->dir;
    149155
     156// umount from util-linux 2.22.2 does not do this:
     157// umount -f uses umount2(MNT_FORCE) immediately,
     158// not trying umount() first.
     159// (Strangely, umount -fl ignores -f: it is equivalent to umount -l.
     160// We do pass both flags in this case)
     161#if 0
    150162        // Let's ask the thing nicely to unmount.
    151163        curstat = umount(zapit);
    152164
    153         // Force the unmount, if necessary.
     165        // Unmount with force and/or lazy flags, if necessary.
    154166        if (curstat && doForce)
     167#endif
    155168            curstat = umount2(zapit, doForce);
    156169
     
    169182            } else {
    170183                status = EXIT_FAILURE;
    171                 bb_perror_msg("can't %sumount %s", (doForce ? "forcibly " : ""), zapit);
     184                bb_perror_msg("can't unmount %s", zapit);
    172185            }
    173186        } else {
Note: See TracChangeset for help on using the changeset viewer.