diff --git a/sflphone-common/src/config/config.cpp b/sflphone-common/src/config/config.cpp index 9c6bb914baf03d73aaa73f94d6f6b2b5340730e5..4f8c02c8de554f762e1963133d452c67122e1654 100644 --- a/sflphone-common/src/config/config.cpp +++ b/sflphone-common/src/config/config.cpp @@ -22,6 +22,9 @@ #include "../global.h" #include <fstream> #include <cstdlib> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> namespace Conf { @@ -255,7 +258,11 @@ ConfigTree::saveConfigTree (const std::string& fileName) } file.close(); - + + if(chmod(fileName.c_str(), S_IRUSR | S_IWUSR)) { + _debug("Failed to set permission on configuration file because: %s\n",strerror(errno)); + } + return true; } @@ -267,7 +274,7 @@ int ConfigTree::populateFromFile (const std::string& fileName) { bool out = false; - + if (fileName.empty()) { return 0; } @@ -332,7 +339,11 @@ ConfigTree::populateFromFile (const std::string& fileName) } file.close(); - + + if(chmod(fileName.c_str(), S_IRUSR | S_IWUSR)) { + _debug("Failed to set permission on configuration file because: %s\n",strerror(errno)); + } + return 1; } diff --git a/sflphone-common/src/config/config.h b/sflphone-common/src/config/config.h index 0872889486659d2a7db64634106f36fcb58ce3a0..0fa75a24acd2e580d1ddb457179f8091507f6d3b 100644 --- a/sflphone-common/src/config/config.h +++ b/sflphone-common/src/config/config.h @@ -155,7 +155,7 @@ class ConfigTree * List of sections. Each sections has an ItemList as child */ SectionMap _sections; - + friend class ConfigTreeIterator; public: diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 7a49b2c04a3948237400173cfd5e3859ec6f01c7..345fb7df667cac41ccbd41ddfaa2c03bea97e44a 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -1293,7 +1293,7 @@ ManagerImpl::createSettingsPath (void) { _path = std::string (HOMEDIR) + DIR_SEPARATOR_STR + "." + PROGDIR; - if (mkdir (_path.data(), 0755) != 0) { + if (mkdir (_path.data(), 0600) != 0) { // If directory creation failed if (errno != EEXIST) { _debug ("Cannot create directory: %s\n", strerror (errno)); @@ -1952,31 +1952,7 @@ void ManagerImpl::setAudioManager (const int32_t& api) switchAudioManager(); return; - - /* - int manager; - - _debug(" ManagerImpl::setAudioManager :: %i \n",api); - - manager = api; - if( manager == PULSEAUDIO ) - { - if(app_is_running("pulseaudio") != 0) - { - // The pulseaudio daemon is not running - manager = ALSA; - notifyErrClient(PULSEAUDIO_NOT_RUNNING); - } - } - - if(manager == api) - { - // it means that we can change the audio manager - setConfig( PREFERENCES , CONFIG_AUDIO , api) ; - switchAudioManager(); - } - */ - + } int32_t