Ticket #5792: 5792-v2.patch

File 5792-v2.patch, 1.7 KB (added by Nigel, 16 years ago)

Clean patch for recent SVN. Untested

  • libs/libmyth/mythmedia.cpp

     
    6262    m_Status = MEDIASTAT_UNKNOWN;
    6363    m_MediaType = MEDIATYPE_UNKNOWN;
    6464
    65     QFileInfo fi(DevicePath);
    66     if (fi.isSymLink())
    67         m_RealDevice = m_DevicePath.section('/', 0, -2) + "/" + fi.readLink();
    68     else
    69         m_RealDevice = QString::null;
     65    m_RealDevice = QString::null;
     66
     67    QFileInfo fi(m_DevicePath);
     68    QString link = QString:: null;
     69    for (uint i = 0; (i < 256) && fi.isSymLink() &&
     70             !(link = fi.readLink()).isEmpty(); i++)
     71    {
     72        if (link[0] == '/') // absolute link
     73            m_RealDevice = link;
     74        else // relative link..
     75            m_RealDevice = fi.absoluteDir().absolutePath() + "/" + link;
     76        fi = QFileInfo(m_RealDevice);
     77    }
    7078}
    7179
    7280bool MythMediaDevice::openDevice()
     
    378386        QString    link = QString::null;
    379387
    380388        // If the device name in the mounts file is a symlink, follow it..
    381         if (fi.isSymLink() && !(link = fi.readLink()).isEmpty())
     389        for (uint i = 0; (i < 256) && fi.isSymLink() &&
     390                 !(link = fi.readLink()).isEmpty(); i++)
    382391        {
    383392            if (link[0] == '/') // absolute link
    384393                deviceNames.push_back(link);
    385394            else // relative link..
    386                 deviceNames.push_back(fi.absoluteDir().absolutePath()
    387                                       + "/" + link);
     395            {
     396                deviceNames.push_back(
     397                    fi.absoluteDir().absolutePath() + "/" + link);
     398            }
     399            fi = QFileInfo(deviceNames.back());
    388400        }
    389401
    390402