mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-02 02:11:11 +02:00
use empty to check string
This commit is contained in:
@@ -275,7 +275,7 @@ bool Cyhttpd::Configure() {
|
||||
std::string groupname= ConfigList["server.group_name"];
|
||||
|
||||
// get user data
|
||||
if(username != "")
|
||||
if(!username.empty())
|
||||
{
|
||||
if((pwd = getpwnam(username.c_str())) == NULL)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ bool Cyhttpd::Configure() {
|
||||
}
|
||||
}
|
||||
// get group data
|
||||
if(groupname != "")
|
||||
if(!groupname.empty())
|
||||
{
|
||||
if((grp = getgrnam(groupname.c_str())) == NULL)
|
||||
{
|
||||
@@ -313,7 +313,7 @@ bool Cyhttpd::Configure() {
|
||||
}
|
||||
#endif
|
||||
#ifdef Y_CONFIG_FEATURE_HTTPD_USER
|
||||
if(username != "" && pwd != NULL && grp != NULL)
|
||||
if(!username.empty() && pwd != NULL && grp != NULL)
|
||||
{
|
||||
log_level_printf(2, "set user and groups\n");
|
||||
|
||||
@@ -321,7 +321,7 @@ bool Cyhttpd::Configure() {
|
||||
setgid(grp->gr_gid);
|
||||
setgroups(0, NULL);
|
||||
// set user group
|
||||
if(groupname != "")
|
||||
if(!groupname.empty())
|
||||
initgroups(username.c_str(), grp->gr_gid);
|
||||
// set user
|
||||
if(setuid(pwd->pw_uid) == -1)
|
||||
@@ -481,7 +481,7 @@ void Cyhttpd::ReadConfig(void) {
|
||||
HTTPD_STANDARD_PORT));
|
||||
Config->setString("WebsiteMain.directory", OrgConfig.getString(
|
||||
"PrivatDocRoot", PRIVATEDOCUMENTROOT));
|
||||
if (OrgConfig.getString("PublicDocRoot", "") != "")
|
||||
if (!OrgConfig.getString("PublicDocRoot", "").empty())
|
||||
Config->setString("WebsiteMain.override_directory",
|
||||
OrgConfig.getString("PublicDocRoot",
|
||||
PRIVATEDOCUMENTROOT));
|
||||
@@ -512,7 +512,7 @@ void Cyhttpd::ReadConfig(void) {
|
||||
Config->setInt32("configfile.version", CONF_VERSION);
|
||||
Config->setString("Language.selected", HTTPD_DEFAULT_LANGUAGE);
|
||||
Config->setString("Language.directory", HTTPD_LANGUAGEDIR);
|
||||
if (Config->getString("WebsiteMain.hosted_directory", "") == "")
|
||||
if (Config->getString("WebsiteMain.hosted_directory", "").empty())
|
||||
Config->setString("WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
|
||||
Config->saveConfig(HTTPD_CONFIGFILE);
|
||||
}
|
||||
@@ -549,7 +549,7 @@ void Cyhttpd::ReadConfig(void) {
|
||||
"WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
|
||||
|
||||
// Check location of logos
|
||||
if (Config->getString("Tuxbox.LogosURL", "") == "") {
|
||||
if (Config->getString("Tuxbox.LogosURL", "").empty()) {
|
||||
if (access(ConfigList["WebsiteMain.override_directory"] + "/logos", R_OK) == 0) {
|
||||
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.override_directory"] + "/logos");
|
||||
have_config = false; //save config
|
||||
|
Reference in New Issue
Block a user