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

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

Updated patch for changes to util.h

  • libs/libmythtv/previewgenerator.cpp

    old new  
    466466    QByteArray fname = filename.toAscii();
    467467    if (small_img.save(fname.constData(), "PNG"))
    468468    {
    469         chmod(fname.constData(), 0666); // Let anybody update it
     469        makeFileAccessible(fname.constData()); // Let anybody update it
    470470
    471471        VERBOSE(VB_PLAYBACK, LOC +
    472472                QString("Saved preview '%0' %1x%2")
     
    481481    if (QFileInfo(fname.constData()).exists() &&
    482482        small_img.save(newfilea.constData(), "PNG"))
    483483    {
    484         chmod(newfilea.constData(), 0666);
     484        makeFileAccessible(newfilea.constData());
    485485        rename(newfilea.constData(), fname.constData());
    486486
    487487        VERBOSE(VB_PLAYBACK, LOC +
  • libs/libmythtv/datadirect.cpp

    old new  
    16441644
    16451645    VERBOSE(VB_GENERAL, "SaveLineupToCache("<<lineupid<<") -- success");
    16461646
    1647     chmod(fna.constData(), 0666); // Let anybody update it
     1647    makeFileAccessible(fna.constData()); // Let anybody update it
    16481648
    16491649    return true;
    16501650}
  • libs/libmyth/util.h

    old new  
    5858MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
    5959MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXXX",
    6060                               bool dir = false);
     61MPUBLIC void makeFileAccessible(QString filename);
    6162
    6263MPUBLIC double MythGetPixelAspectRatio(void);
    6364
  • libs/libmyth/util.cpp

    old new  
    802802    return tmpFileName;
    803803}
    804804
     805/** \fn makeFileAccessible(QString)
     806 *  \brief Makes a file accessible to all frontends/backends.
     807 *
     808 *   This function abstracts the functionality of making a file accessible to
     809 *   all frontends and backends.  Currently it contains a permissions hack that
     810 *   makes a file accessible even on a system with an improperly configured
     811 *   environment (umask/group) where the frontend and backend are being run as
     812 *   different users or where a NFS share is used but UID's/GID's differ on
     813 *   different hosts.
     814 *
     815 *   Though the function currently only changes the file mode to 0666, by
     816 *   abstracting the functionality, it will be easier to make changes in the
     817 *   future if a better approach is chosen.  Similarly, using this function
     818 *   allows the hack to be applied only when required if code is written to
     819 *   detect or allow the user to specify their system is misconfigured.
     820 *
     821 *  \param filename   Path of file to make accessible
     822 */
     823void makeFileAccessible(QString filename)
     824{
     825    QByteArray fname = filename.toAscii();
     826    chmod(fname.constData(), 0666);
     827}
     828
    805829double MythGetPixelAspectRatio(void)
    806830{
    807831    float pixelAspect = 1.0;
  • programs/mythbackend/mythxml.cpp

    old new  
    11961196    QByteArray fname = pRequest->m_sFileName.toAscii();
    11971197    img.save( fname.constData(), "PNG" );
    11981198
     1199    makeFileAccessible(fname.constData());
     1200
    11991201    delete pImage;
    12001202}
    12011203