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

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

Updated patch for post-Qt4 trunk

  • libs/libmythtv/datadirect.cpp

     
    16181618
    16191619    VERBOSE(VB_GENERAL, "SaveLineupToCache("<<lineupid<<") -- success");
    16201620
    1621     chmod(fn.ascii(), 0666); // Let anybody update it
     1621    makeFileAccessible(fn); // Let anybody update it
    16221622
    16231623    return true;
    16241624}
  • libs/libmythtv/previewgenerator.cpp

     
    460460
    461461    if (small_img.save(filename, "PNG"))
    462462    {
    463         chmod(filename.ascii(), 0666); // Let anybody update it
     463        makeFileAccessible(filename); // Let anybody update it
    464464
    465465        VERBOSE(VB_PLAYBACK, LOC +
    466466                QString("Saved preview '%0' %1x%2")
     
    474474    if (QFileInfo(filename.ascii()).exists() &&
    475475        small_img.save(newfile.ascii(), "PNG"))
    476476    {
    477         chmod(newfile.ascii(), 0666);
     477        makeFileAccessible(newfile);
    478478        rename(newfile.ascii(), filename.ascii());
    479479
    480480        VERBOSE(VB_PLAYBACK, LOC +
  • programs/mythbackend/mythxml.cpp

     
    12371237
    12381238    img.save( pRequest->m_sFileName.ascii(), "PNG" );
    12391239
     1240    makeFileAccessible(pRequest->m_sFileName);
     1241
    12401242    delete pImage;
    12411243}
    12421244
  • libs/libmyth/util.cpp

     
    928928    return tmpFileName;
    929929}
    930930
     931/** \fn makeFileAccessible(QString)
     932 *  \brief Makes a file accessible to all frontends/backends.
     933 *
     934 *   This function abstracts the functionality of making a file accessible to
     935 *   all frontends and backends.  Currently it contains a permissions hack that
     936 *   makes a file accessible even on a system with an improperly configured
     937 *   environment (umask/group) where the frontend and backend are being run as
     938 *   different users or where a NFS share is used but UID's/GID's differ on
     939 *   different hosts.
     940 *
     941 *   Though the function currently only changes the file mode to 0666, by
     942 *   abstracting the functionality, it will be easier to make changes in the
     943 *   future if a better approach is chosen.  Similarly, using this function
     944 *   allows the hack to be applied only when required if code is written to
     945 *   detect or allow the user to specify their system is misconfigured.
     946 *
     947 *  \param filename   Path of file to make accessible
     948 */
     949void makeFileAccessible(QString filename)
     950{
     951    chmod(filename.ascii(), 0666);
     952}
     953
    931954double MythGetPixelAspectRatio(void)
    932955{
    933956    float pixelAspect = 1.0;
  • libs/libmyth/util.h

     
    8383MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
    8484MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXXX",
    8585                               bool dir = false);
     86MPUBLIC void makeFileAccessible(QString filename);
    8687MPUBLIC unsigned long long myth_get_approximate_large_file_size(
    8788    const QString &fname);
    8889