Ticket #4860: mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible.2.patch

File mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible.2.patch, 3.8 KB (added by sphery <mtdean@…>, 17 years ago)

Updated patch.

  • libs/libmythtv/previewgenerator.cpp

    old new  
    480480    QByteArray fname = filename.toAscii();
    481481    if (small_img.save(fname.constData(), "PNG"))
    482482    {
    483         chmod(fname.constData(), 0666); // Let anybody update it
     483        makeFileAccessible(fname.constData()); // Let anybody update it
    484484
    485485        VERBOSE(VB_PLAYBACK, LOC +
    486486                QString("Saved preview '%0' %1x%2")
     
    495495    if (QFileInfo(fname.constData()).exists() &&
    496496        small_img.save(newfilea.constData(), "PNG"))
    497497    {
    498         chmod(newfilea.constData(), 0666);
     498        makeFileAccessible(newfilea.constData());
    499499        rename(newfilea.constData(), fname.constData());
    500500
    501501        VERBOSE(VB_PLAYBACK, LOC +
  • libs/libmythtv/datadirect.cpp

    old new  
    16701670
    16711671    VERBOSE(VB_GENERAL, "SaveLineupToCache("<<lineupid<<") -- success");
    16721672
    1673     chmod(fna.constData(), 0666); // Let anybody update it
     1673    makeFileAccessible(fna.constData()); // Let anybody update it
    16741674
    16751675    return true;
    16761676}
  • libs/libmyth/util.h

    old new  
    6161MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
    6262MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXXX",
    6363                               bool dir = false);
     64MPUBLIC void makeFileAccessible(QString filename);
    6465
    6566MPUBLIC double MythGetPixelAspectRatio(void);
    6667
  • libs/libmyth/util.cpp

    old new  
    11531153    return tmpFileName;
    11541154}
    11551155
     1156/** \fn makeFileAccessible(QString)
     1157 *  \brief Makes a file accessible to all frontends/backends.
     1158 *
     1159 *   This function abstracts the functionality of making a file accessible to
     1160 *   all frontends and backends.  Currently it contains a permissions hack that
     1161 *   makes a file accessible even on a system with an improperly configured
     1162 *   environment (umask/group) where the frontend and backend are being run as
     1163 *   different users or where a NFS share is used but UID's/GID's differ on
     1164 *   different hosts.
     1165 *
     1166 *   Though the function currently only changes the file mode to 0666, by
     1167 *   abstracting the functionality, it will be easier to make changes in the
     1168 *   future if a better approach is chosen.  Similarly, using this function
     1169 *   allows the hack to be applied only when required if code is written to
     1170 *   detect or allow the user to specify their system is misconfigured.
     1171 *
     1172 *  \param filename   Path of file to make accessible
     1173 */
     1174void makeFileAccessible(QString filename)
     1175{
     1176    QByteArray fname = filename.toAscii();
     1177    chmod(fname.constData(), 0666);
     1178}
     1179
    11561180double MythGetPixelAspectRatio(void)
    11571181{
    11581182    float pixelAspect = 1.0;
  • programs/mythbackend/mythxml.cpp

    old new  
    12071207    QByteArray fname = pRequest->m_sFileName.toAscii();
    12081208    img.save( fname.constData(), "PNG" );
    12091209
     1210    makeFileAccessible(fname.constData());
     1211
    12101212    delete pImage;
    12111213}
    12121214