Loading src/blogi.cpp +13 −3 Changes for src/blogi.cpp: 13 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -679,9 +679,19 @@ public: try{ blogi::Blogi blg(getServerSocket(),debug); #ifndef Windows struct passwd *pwd=getpwnam("blogi"); seteuid(pwd->pw_uid); setegid(pwd->pw_gid); struct passwd pwd_storage; char buffer[1024]; struct passwd *result = NULL; int s; const char *username = "blogi"; if(getpwnam_r(username, &pwd_storage, buffer, sizeof(buffer), &result)!=0){ throw httpexception[libhttppp::HTTPException::Error] << "can'T change user !"; } seteuid(pwd_storage.pw_uid); setegid(pwd_storage.pw_gid); #endif blg.runEventloop(); }catch(libhttppp::HTTPException &e){ Loading src/plugin.cpp +10 −13 Changes for src/plugin.cpp: 10 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -49,26 +49,20 @@ blogi::SearchRet::~SearchRet(){ } blogi::SearchRet::Data * blogi::SearchRet::getfirstData(){ return _firstData; return _firstData.get(); } void blogi::SearchRet::clear(){ Data *curdat=_firstData; while(curdat){ Data *nxtdat=curdat->nextData(); curdat->_next=nullptr; delete curdat; curdat=nxtdat; } _firstData.reset(); } void blogi::SearchRet::push_back(const blogi::SearchRet::Data& dat){ if(!_firstData){ _firstData=new Data(dat); _lastData=_firstData; _firstData=std::make_unique<Data>(dat); _lastData=_firstData.get(); }else{ _lastData->_next=new Data(dat); _lastData=_lastData->_next; _lastData->_next=std::make_unique<Data>(dat); _lastData=_lastData->_next.get(); } } Loading @@ -88,7 +82,7 @@ blogi::SearchRet::Data::~Data(){ } blogi::SearchRet::Data* blogi::SearchRet::Data::nextData(){ return _next; return _next.get(); } Loading Loading @@ -212,6 +206,9 @@ void blogi::Plugin::loadPlugins(const char *path, PluginArgs *args){ } blogi::Plugin::~Plugin(){ for(PluginData *curdat=_firstPlugin.get(); curdat; curdat=curdat->next.get()){ delete static_cast<PluginApi*>(curdat->pldata); } } const blogi::Plugin::PluginData* blogi::Plugin::getFirstPlugin() const{ Loading src/plugin.h +3 −3 Changes for src/plugin.h: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -72,9 +72,9 @@ namespace blogi { std::string anchor; std::vector<char> text; Data *nextData(); private: Data(const Data &dat); Data *_next; private: std::unique_ptr<Data> _next; friend class SearchRet; }; Loading @@ -82,7 +82,7 @@ namespace blogi { void clear(); Data *getfirstData(); private: Data *_firstData; std::unique_ptr<Data> _firstData; Data *_lastData; }; Loading Loading
src/blogi.cpp +13 −3 Changes for src/blogi.cpp: 13 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -679,9 +679,19 @@ public: try{ blogi::Blogi blg(getServerSocket(),debug); #ifndef Windows struct passwd *pwd=getpwnam("blogi"); seteuid(pwd->pw_uid); setegid(pwd->pw_gid); struct passwd pwd_storage; char buffer[1024]; struct passwd *result = NULL; int s; const char *username = "blogi"; if(getpwnam_r(username, &pwd_storage, buffer, sizeof(buffer), &result)!=0){ throw httpexception[libhttppp::HTTPException::Error] << "can'T change user !"; } seteuid(pwd_storage.pw_uid); setegid(pwd_storage.pw_gid); #endif blg.runEventloop(); }catch(libhttppp::HTTPException &e){ Loading
src/plugin.cpp +10 −13 Changes for src/plugin.cpp: 10 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -49,26 +49,20 @@ blogi::SearchRet::~SearchRet(){ } blogi::SearchRet::Data * blogi::SearchRet::getfirstData(){ return _firstData; return _firstData.get(); } void blogi::SearchRet::clear(){ Data *curdat=_firstData; while(curdat){ Data *nxtdat=curdat->nextData(); curdat->_next=nullptr; delete curdat; curdat=nxtdat; } _firstData.reset(); } void blogi::SearchRet::push_back(const blogi::SearchRet::Data& dat){ if(!_firstData){ _firstData=new Data(dat); _lastData=_firstData; _firstData=std::make_unique<Data>(dat); _lastData=_firstData.get(); }else{ _lastData->_next=new Data(dat); _lastData=_lastData->_next; _lastData->_next=std::make_unique<Data>(dat); _lastData=_lastData->_next.get(); } } Loading @@ -88,7 +82,7 @@ blogi::SearchRet::Data::~Data(){ } blogi::SearchRet::Data* blogi::SearchRet::Data::nextData(){ return _next; return _next.get(); } Loading Loading @@ -212,6 +206,9 @@ void blogi::Plugin::loadPlugins(const char *path, PluginArgs *args){ } blogi::Plugin::~Plugin(){ for(PluginData *curdat=_firstPlugin.get(); curdat; curdat=curdat->next.get()){ delete static_cast<PluginApi*>(curdat->pldata); } } const blogi::Plugin::PluginData* blogi::Plugin::getFirstPlugin() const{ Loading
src/plugin.h +3 −3 Changes for src/plugin.h: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -72,9 +72,9 @@ namespace blogi { std::string anchor; std::vector<char> text; Data *nextData(); private: Data(const Data &dat); Data *_next; private: std::unique_ptr<Data> _next; friend class SearchRet; }; Loading @@ -82,7 +82,7 @@ namespace blogi { void clear(); Data *getfirstData(); private: Data *_firstData; std::unique_ptr<Data> _firstData; Data *_lastData; }; Loading