Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/libbb/loop.c


Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/libbb/loop.c

    r2725 r3232  
    8585   file/offset if it finds one.
    8686 */
    87 int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offset)
     87int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offset, int ro)
    8888{
    8989    char dev[LOOP_NAMESIZE];
     
    9494
    9595    /* Open the file.  Barf if this doesn't work.  */
    96     mode = O_RDWR;
     96    mode = ro ? O_RDONLY : O_RDWR;
    9797    ffd = open(file, mode);
    9898    if (ffd < 0) {
    99         mode = O_RDONLY;
    100         ffd = open(file, mode);
     99        if (mode != O_RDONLY) {
     100            mode = O_RDONLY;
     101            ffd = open(file, mode);
     102        }
    101103        if (ffd < 0)
    102104            return -errno;
     
    149151
    150152        /* If this block device already set up right, re-use it.
    151            (Yes this is racy, but associating two loop devices with the same
    152            file isn't pretty either.  In general, mounting the same file twice
    153            without using losetup manually is problematic.)
     153         * (Yes this is racy, but associating two loop devices with the same
     154         * file isn't pretty either.  In general, mounting the same file twice
     155         * without using losetup manually is problematic.)
    154156         */
    155157        } else
Note: See TracChangeset for help on using the changeset viewer.