mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
Merge branch 'next' of coolstreamtech.de:cst-public-gui-neutrino into next
Conflicts:
lib/libconfigfile/configfile.cpp
src/system/setting_helpers.cpp
src/zapit/src/femanager.cpp
Origin commit data
------------------
Branch: ni/coolstream
Commit: aa60c85768
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-03-07 (Thu, 07 Mar 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -91,9 +93,11 @@ bool CConfigFile::loadConfig(const std::string & filename)
|
||||
|
||||
bool CConfigFile::saveConfig(const char * const filename)
|
||||
{
|
||||
std::fstream configFile(filename, std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
|
||||
std::string tmpname = std::string(filename) + ".tmp";
|
||||
unlink(tmpname.c_str());
|
||||
std::fstream configFile(tmpname.c_str(), std::ios::out);
|
||||
|
||||
if (configFile.is_open())
|
||||
if (configFile != NULL())
|
||||
{
|
||||
std::cout << "[ConfigFile] saving " << filename << std::endl;
|
||||
for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); ++it)
|
||||
@@ -104,14 +108,17 @@ bool CConfigFile::saveConfig(const char * const filename)
|
||||
configFile.sync();
|
||||
configFile.close();
|
||||
|
||||
chmod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
chmod(tmpname.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
/* TODO: check available space? */
|
||||
rename(tmpname.c_str(), filename);
|
||||
|
||||
modifiedFlag = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "[ConfigFile] Unable to open file " << filename << " for writing." << std::endl;
|
||||
std::cerr << "[ConfigFile] Unable to open file " << tmpname << " for writing: "
|
||||
<< strerror(errno) << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user