mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +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:
@@ -392,7 +392,7 @@ void CFileBrowser::ChangeDir(const std::string & filename, int selection)
|
||||
std::string extension = file->Name.substr(ext_pos + 1, name.length() - ext_pos);
|
||||
if(strcasecmp(extension.c_str(), "ts") == 0) {
|
||||
std::string fname = file->Name.substr(0, ext_pos) + ".xml";
|
||||
if(access(fname.c_str(), F_OK) == 0)
|
||||
if(access(fname, F_OK) == 0)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@@ -1307,7 +1307,7 @@ std::string CMovieBrowser::getScreenshotName(std::string movie)
|
||||
ext = *it;
|
||||
ret.replace(found, ext.length(), ext);
|
||||
++it;
|
||||
if (!access(ret.c_str(), F_OK))
|
||||
if (!access(ret, F_OK))
|
||||
return ret;
|
||||
}
|
||||
return "";
|
||||
|
@@ -68,7 +68,7 @@ CNetworkService::CNetworkService(std::string cmd, std::string opts)
|
||||
enabled = false;
|
||||
|
||||
std::string file = TOUCH_BASE + cmd;
|
||||
if (!access(file.c_str(), F_OK))
|
||||
if (!access(file, F_OK))
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ int CNetworkServiceSetup::showNetworkServiceSetup()
|
||||
std::string execute2 = "/sbin/" + services[i].cmd;
|
||||
|
||||
active = false;
|
||||
if ( !(access(execute1.c_str(), F_OK)) || !(access(execute2.c_str(), F_OK)) )
|
||||
if ( !(access(execute1, F_OK)) || !(access(execute2, F_OK)) )
|
||||
active = true;
|
||||
|
||||
if ( (services[i].name == "Telnet") && useinetd)
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include <driver/screen_max.h>
|
||||
|
||||
#include <xmlinterface.h>
|
||||
#include <system/helpers.h>
|
||||
#include <system/debug.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -145,10 +146,15 @@ CMenuOptionStringChooser* COsdLangSetup::getTzItems()
|
||||
if (!strcmp(xmlGetName(search), "zone"))
|
||||
{
|
||||
std::string name = xmlGetAttribute(search, "name");
|
||||
// std::string zone = xmlGetAttribute(search, "zone");
|
||||
std::string zone = xmlGetAttribute(search, "zone");
|
||||
//printf("Timezone: %s -> %s\n", name.c_str(), zone.c_str());
|
||||
tzSelect->addOption(name.c_str());
|
||||
found = true;
|
||||
if (access("/usr/share/zoneinfo/" + zone, R_OK))
|
||||
printf("[neutrino] timezone file '%s' not installed\n", zone.c_str());
|
||||
else
|
||||
{
|
||||
tzSelect->addOption(name);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
search = search->xmlNextNode;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -104,7 +104,7 @@ void CNetworkConfig::init_vars(void)
|
||||
wireless = 0;
|
||||
std::string tmp = "/sys/class/net/" + ifname + "/wireless";
|
||||
|
||||
if(access(tmp.c_str(), R_OK) == 0)
|
||||
if(access(tmp, R_OK) == 0)
|
||||
wireless = 1;
|
||||
if(wireless)
|
||||
readWpaConfig();
|
||||
|
@@ -466,7 +466,8 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
|
||||
name = xmlGetAttribute(search, "name");
|
||||
if(g_settings.timezone == name) {
|
||||
zone = xmlGetAttribute(search, "zone");
|
||||
found = true;
|
||||
if (!access("/usr/share/zoneinfo/" + zone, R_OK))
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ bool cYTCache::getNameIfExists(std::string &fname, const std::string &id, int it
|
||||
char ytitag[10];
|
||||
snprintf(ytitag, sizeof(ytitag), "%d", itag);
|
||||
std::string f = g_settings.downloadcache_dir + "/" + id + "-" + std::string(ytitag) + "." + ext;
|
||||
if (access(f.c_str(), R_OK))
|
||||
if (access(f, R_OK))
|
||||
return false;
|
||||
fname = f;
|
||||
return true;
|
||||
@@ -78,10 +78,10 @@ bool cYTCache::getNameIfExists(std::string &fname, const std::string &id, int it
|
||||
bool cYTCache::useCachedCopy(MI_MOVIE_INFO *mi)
|
||||
{
|
||||
std::string file = getName(mi);
|
||||
if (access(file.c_str(), R_OK))
|
||||
if (access(file, R_OK))
|
||||
return false;
|
||||
std::string xml = getName(mi, "xml");
|
||||
if (!access(xml.c_str(), R_OK)) {
|
||||
if (!access(xml, R_OK)) {
|
||||
mi->file.Url = file;
|
||||
return true;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ bool cYTCache::download(MI_MOVIE_INFO *mi)
|
||||
{
|
||||
std::string file = getName(mi);
|
||||
std::string xml = getName(mi, "xml");
|
||||
if (!access(file.c_str(), R_OK) && !access(xml.c_str(), R_OK)) {
|
||||
if (!access(file, R_OK) && !access(xml, R_OK)) {
|
||||
fprintf(stderr, "%s: %s already present and valid\n", __func__, file.c_str());
|
||||
return true;
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <OpenThreads/ScopedLock>
|
||||
#include "settings.h"
|
||||
#include "helpers.h"
|
||||
#include "set_threadname.h"
|
||||
#include <global.h>
|
||||
|
||||
@@ -615,7 +616,7 @@ bool cYTFeedParser::DownloadThumbnail(cYTVideoInfo &vinfo, CURL *_curl_handle)
|
||||
bool found = false;
|
||||
if (!vinfo.thumbnail.empty()) {
|
||||
std::string fname = thumbnail_dir + "/" + vinfo.id + ".jpg";
|
||||
found = !access(fname.c_str(), F_OK);
|
||||
found = !access(fname, F_OK);
|
||||
if (!found) {
|
||||
for (int *fmtp = itags; *fmtp && !found; fmtp++)
|
||||
found = cYTCache::getInstance()->getNameIfExists(fname, vinfo.id, *fmtp);
|
||||
|
Reference in New Issue
Block a user