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

File mythtv-scaled_preview_filesystem_permissions-makeFileAccessible-20080307.patch, 3.5 KB (added by sphery <mtdean@…>, 18 years ago)

Actually includes makeFileAccessible() function

  • libs/libmythtv/datadirect.cpp

    old new bool DataDirectProcessor::SaveLineupToCa  
    15611561
    15621562    VERBOSE(VB_GENERAL, "SaveLineupToCache("<<lineupid<<") -- success");
    15631563
    1564     chmod(fn.ascii(), 0666); // Let anybody update it
     1564    makeFileAccessible(fn); // Let anybody update it
    15651565
    15661566    return true;
    15671567}
  • libs/libmythtv/previewgenerator.cpp

    old new bool PreviewGenerator::SavePreview(QStri  
    461461
    462462    if (small_img.save(filename, "PNG"))
    463463    {
    464         chmod(filename.ascii(), 0666); // Let anybody update it
     464        makeFileAccessible(filename); // Let anybody update it
    465465
    466466        VERBOSE(VB_PLAYBACK, LOC +
    467467                QString("Saved preview '%0' %1x%2")
    bool PreviewGenerator::SavePreview(QStri  
    475475    if (QFileInfo(filename.ascii()).exists() &&
    476476        small_img.save(newfile.ascii(), "PNG"))
    477477    {
    478         chmod(newfile.ascii(), 0666);
     478        makeFileAccessible(newfile);
    479479        rename(newfile.ascii(), filename.ascii());
    480480
    481481        VERBOSE(VB_PLAYBACK, LOC +
  • programs/mythbackend/mythxml.cpp

    old new void MythXML::GetPreviewImage( HTTPReque  
    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

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

    old new MPUBLIC bool telnet(const QString &host,  
    7979MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
    8080MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXXX",
    8181                               bool dir = false);
     82MPUBLIC void makeFileAccessible(QString filename);
    8283MPUBLIC unsigned long long myth_get_approximate_large_file_size(
    8384    const QString &fname);
    8485