VirtualBox

Changeset 25023 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Nov 26, 2009 4:11:44 PM (15 years ago)
Author:
vboxsync
Message:

Additions/linux/mount.vboxsf: work around mounts failing if a file of the same name as the share exists in the current directory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c

    r21560 r25023  
    562562    if (err == -1 && errno == EPROTO)
    563563    {
     564        /* Sometimes the mount utility messes up the share name.  Try to
     565         * un-mangle it again. */
     566        char szCWD[4096];
     567        size_t cchCWD;
     568        if (!getcwd(szCWD, sizeof(szCWD)))
     569            panic_err("%s: failed to get the current working directory", argv[0]);
     570        cchCWD = strlen(szCWD);
     571        if (!strncmp(host_name, szCWD, cchCWD))
     572        {
     573            while (host_name[cchCWD] == '/')
     574                ++cchCWD;
     575            /* We checked before that we have enough space */
     576            strcpy (mntinf.name, host_name + cchCWD);
     577        }
     578        err = mount (NULL, mount_point, "vboxsf", flags, &mntinf);
     579    }
     580    if (err == -1 && errno == EPROTO)
     581    {
    564582        /* New mount tool with old vboxsf module? Try again using the old
    565583         * vbsf_mount_info_old structure. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette