mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
overload access(2)
Conflicts: src/driver/pictureviewer/pictureviewer.cpp src/gui/components/cc_item_picture.cpp src/gui/movieplayer.cpp src/gui/osdlang_setup.cpp src/neutrino.cpp src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp src/nhttpd/yhttpd.cpp src/system/helpers.h src/system/setting_helpers.cpp
This commit is contained in:
@@ -316,7 +316,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
||||
std::string timestr;
|
||||
bool have_logos = false;
|
||||
|
||||
if(hh->WebserverConfigList["TUXBOX_LOGOS_URL"] != "" ||hh->WebserverConfigList["ExtrasDocumentRoot"] == "web" || (access((hh->WebserverConfigList["ExtrasDocumentRoot"]+"/logos").c_str(),4)==0) )
|
||||
if(hh->WebserverConfigList["TUXBOX_LOGOS_URL"] != "" ||hh->WebserverConfigList["ExtrasDocumentRoot"] == "web" || (access(hh->WebserverConfigList["ExtrasDocumentRoot"]+"/logos",R_OK)==0) )
|
||||
have_logos = true;
|
||||
CZapitClient::BouquetChannelList::iterator channel = channellist->begin();
|
||||
for (; channel != channellist->end();channel++)
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <system/set_threadname.h>
|
||||
#include <system/helpers.h>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <ylogging.h>
|
||||
@@ -549,16 +550,16 @@ void Cyhttpd::ReadConfig(void) {
|
||||
|
||||
// Check location of logos
|
||||
if (Config->getString("Tuxbox.LogosURL", "") == "") {
|
||||
if (access(std::string(ConfigList["WebsiteMain.override_directory"] + "/logos").c_str(), R_OK) == 0) {
|
||||
if (access(ConfigList["WebsiteMain.override_directory"] + "/logos", R_OK) == 0) {
|
||||
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.override_directory"] + "/logos");
|
||||
have_config = false; //save config
|
||||
}
|
||||
else if (access(std::string(ConfigList["WebsiteMain.directory"] + "/logos").c_str(), R_OK) == 0) {
|
||||
else if (access(ConfigList["WebsiteMain.directory"] + "/logos", R_OK) == 0){
|
||||
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.directory"] + "/logos");
|
||||
have_config = false; //save config
|
||||
}
|
||||
#ifdef Y_CONFIG_USE_HOSTEDWEB
|
||||
else if (access(std::string(ConfigList["WebsiteMain.hosted_directory"] + "/logos").c_str(), R_OK) == 0) {
|
||||
else if (access(ConfigList["WebsiteMain.hosted_directory"] + "/logos", R_OK) == 0){
|
||||
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.hosted_directory"] + "/logos");
|
||||
have_config = false; //save config
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@
|
||||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
|
||||
// yhttpd
|
||||
#include <yconfig.h>
|
||||
#include <yhttpd.h>
|
||||
@@ -109,9 +111,9 @@ std::string CLanguage::getTranslation(std::string id){
|
||||
std::string CLanguage::getLanguageDir(void){
|
||||
std::string tmpfilename = "/"+Cyhttpd::ConfigList["Language.directory"],dir="";
|
||||
|
||||
if( access(std::string(Cyhttpd::ConfigList["WebsiteMain.override_directory"] + tmpfilename).c_str(),4) == 0)
|
||||
if( access(Cyhttpd::ConfigList["WebsiteMain.override_directory"] + tmpfilename,R_OK) == 0)
|
||||
dir = Cyhttpd::ConfigList["WebsiteMain.override_directory"] + tmpfilename;
|
||||
else if(access(std::string(Cyhttpd::ConfigList["WebsiteMain.directory"] + tmpfilename).c_str(),4) == 0)
|
||||
else if(access(Cyhttpd::ConfigList["WebsiteMain.directory"] + tmpfilename,R_OK) == 0)
|
||||
dir = Cyhttpd::ConfigList["WebsiteMain.directory"] + tmpfilename;
|
||||
return dir;
|
||||
}
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <system/helpers.h>
|
||||
// yhttpd
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
@@ -179,16 +180,16 @@ std::string CmodSendfile::GetFileName(CyhookHandler *hh, std::string path, std::
|
||||
tmpfilename = path + "/" + filename;
|
||||
else
|
||||
tmpfilename = path + filename;
|
||||
if (access(std::string(hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename).c_str(), 4) == 0)
|
||||
if (access(hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename, R_OK) == 0)
|
||||
tmpfilename = hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename;
|
||||
else if (access(std::string(hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename + ".gz").c_str(), 4) == 0)
|
||||
else if (access(hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename + ".gz", R_OK) == 0)
|
||||
tmpfilename = hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename + ".gz";
|
||||
else if (access(std::string(hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename).c_str(), 4) == 0)
|
||||
else if (access(hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename, R_OK) == 0)
|
||||
tmpfilename = hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename;
|
||||
else if (access(std::string(hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename + ".gz").c_str(), 4) == 0)
|
||||
else if (access(hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename + ".gz", R_OK) == 0)
|
||||
tmpfilename = hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename + ".gz";
|
||||
#ifdef Y_CONFIG_FEATUE_SENDFILE_CAN_ACCESS_ALL
|
||||
else if(access(tmpfilename.c_str(),4) == 0)
|
||||
else if(access(tmpfilename,R_OK) == 0)
|
||||
;
|
||||
#endif
|
||||
else {
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "mod_weblog.h"
|
||||
#include <helper.h>
|
||||
#include <system/helpers.h>
|
||||
|
||||
//=============================================================================
|
||||
// Initialization of static variables
|
||||
@@ -67,7 +68,7 @@ bool CmWebLog::OpenLogFile() {
|
||||
if (WebLogFile == NULL) {
|
||||
bool isNew = false;
|
||||
pthread_mutex_lock(&WebLog_mutex); // yeah, its mine
|
||||
if (access(WebLogFilename.c_str(), 4) != 0)
|
||||
if (access(WebLogFilename, R_OK) != 0)
|
||||
isNew = true;
|
||||
WebLogFile = fopen(WebLogFilename.c_str(), "a");
|
||||
if (isNew) {
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <signal.h>
|
||||
// tuxbox
|
||||
#include <configfile.h>
|
||||
#include <system/helpers.h>
|
||||
// yhttpd
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
@@ -423,7 +424,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
std::string if_value, if_then, if_else;
|
||||
if (ySplitString(ycmd_name, "~", if_value, if_then)) {
|
||||
ySplitString(if_then, "~", if_then, if_else);
|
||||
yresult = (access(if_value.c_str(), 4) == 0) ? if_then
|
||||
yresult = (access(if_value, R_OK) == 0) ? if_then
|
||||
: if_else;
|
||||
}
|
||||
} else if (ycmd_type == "include") {
|
||||
@@ -731,7 +732,7 @@ std::string CyParser::func_do_reload_httpd_config(CyhookHandler *, std::string)
|
||||
// y-func : Change httpd (process image) on the fly
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CyParser::func_change_httpd(CyhookHandler *hh, std::string para) {
|
||||
if (para != "" && access(para.c_str(), 4) == 0) {
|
||||
if (para != "" && access(para, R_OK) == 0) {
|
||||
hh->status = HANDLED_ABORT;
|
||||
char * argv[2] = { (char *)para.c_str(), NULL };
|
||||
int err = execvp(argv[0], argv); // no return if successful
|
||||
|
Reference in New Issue
Block a user