Permalink
Browse files

MythMiscUtil: Fix coverity 746744. Unchecked return value from library.

  • Loading branch information...
stuartm committed Jun 9, 2013
1 parent 791b6c6 commit 68a1b2397d43146ed97f1098dd49ecb1e2bcd3cc
@@ -421,10 +421,16 @@ QString createTempFile(QString name_template, bool dir)
*
* \param filename Path of file to make accessible
*/
void makeFileAccessible(QString filename)
bool makeFileAccessible(QString filename)
{
QByteArray fname = filename.toLatin1();
chmod(fname.constData(), 0666);
int ret = chmod(fname.constData(), 0666);
if (ret == -1)
{
LOG(VB_GENERAL, LOG_ERR, QString("Unable to change permissions on file. (%1)").arg(filename));
return false;
}
return true;
}
/**
@@ -27,7 +27,7 @@ MBASE_PUBLIC bool telnet(const QString &host, int port);
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
MBASE_PUBLIC QString createTempFile(
QString name_template = "/tmp/mythtv_XXXXXX", bool dir = false);
MBASE_PUBLIC void makeFileAccessible(QString filename);
MBASE_PUBLIC bool makeFileAccessible(QString filename);
MBASE_PUBLIC QString getResponse(const QString &query, const QString &def);
MBASE_PUBLIC int intResponse(const QString &query, int def);
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in ABI changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods in exported headers.
#define MYTH_BINARY_VERSION "0.27.20130608-2"
#define MYTH_BINARY_VERSION "0.27.20130609-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
@@ -1581,7 +1581,11 @@ bool DataDirectProcessor::SaveLineupToCache(const QString &lineupid) const
LOG(VB_GENERAL, LOG_INFO, LOC + "SaveLineupToCache("+lineupid+
") -- success");
makeFileAccessible(fna.constData()); // Let anybody update it
bool ret = makeFileAccessible(fna.constData()); // Let anybody update it
if (!ret)
{
// Nothing, makeFileAccessible will print an error
}
return true;
}
@@ -583,7 +583,14 @@ bool PreviewGenerator::SavePreview(QString filename,
if (f.open() && small_img.save(&f, "PNG"))
{
// Let anybody update it
makeFileAccessible(f.fileName().toLocal8Bit().constData());
bool ret = makeFileAccessible(f.fileName().toLocal8Bit().constData());
if (!ret)
{
LOG(VB_GENERAL, LOG_ERR, "Unable to change permissions on "
"preview image. Backends and frontends "
"running under different users will be "
"unable to access it");
}
QFile of(filename);
of.remove();
if (f.rename(filename))

0 comments on commit 68a1b23

Please sign in to comment.