added to config: parameter static_auth_dir_tmp
with a path to directory for tmp files (for upload functino) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@572 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
7e0014865e
commit
796985472a
|
@ -11,7 +11,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <cstdio>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
|
@ -69,15 +68,8 @@ struct stat sb;
|
|||
int err = errno;
|
||||
|
||||
// !! skasowac takze plik z bazy danych
|
||||
log << log1 << "Content: can't move the tmp file from: " << tmp_filename;
|
||||
log << log1 << ", to: " << path;
|
||||
log << log1 << ", errno: " << err;
|
||||
|
||||
const char * err_msg = strerror(err);
|
||||
|
||||
if( err_msg )
|
||||
log << log1 << ": " << err_msg;
|
||||
|
||||
log << log1 << "Content: can't move the tmp file from: " << tmp_filename << ", to: " << path << ", ";
|
||||
log.SystemErr(err);
|
||||
log << logend;
|
||||
|
||||
request.status = Error::permission_denied;
|
||||
|
|
|
@ -109,6 +109,7 @@ void Config::AssignValues()
|
|||
|
||||
data.post_file_max = Int("post_file_max", 8388608); // 8 MB
|
||||
data.static_auth_dir = Text("static_auth_dir");
|
||||
data.static_auth_dir_tmp = Text("static_auth_dir_tmp");
|
||||
|
||||
data.templates_dir = Text("templates_dir");
|
||||
data.templates_dir_default = Text("templates_dir_default");
|
||||
|
|
|
@ -115,6 +115,10 @@ public:
|
|||
// directory for static files (for fastcgi authorizer mode)
|
||||
std::string static_auth_dir;
|
||||
|
||||
// temporary dir for static content used by upload function
|
||||
// should be on the same partition as static_auth_dir
|
||||
std::string static_auth_dir_tmp;
|
||||
|
||||
// default locale: en pl
|
||||
std::string locale_str;
|
||||
|
||||
|
@ -124,8 +128,6 @@ public:
|
|||
// directory with default locale files (those from winix)
|
||||
std::string locale_dir_default;
|
||||
|
||||
|
||||
|
||||
// below variables are based on the other config variables
|
||||
|
||||
// base_url_prefix + base_server
|
||||
|
|
11
core/log.cpp
11
core/log.cpp
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "log.h"
|
||||
#include <ctime>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
Log::Log()
|
||||
|
@ -179,6 +180,16 @@ return *this;
|
|||
}
|
||||
|
||||
|
||||
void Log::SystemErr(int err)
|
||||
{
|
||||
(*this) << "errno: " << err;
|
||||
|
||||
const char * err_msg = strerror(err);
|
||||
|
||||
if( err_msg )
|
||||
(*this) << " (" << err_msg << ")";
|
||||
}
|
||||
|
||||
|
||||
void Log::SaveLog()
|
||||
{
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
Log & operator<<(double s);
|
||||
Log & operator<<(Manipulators m);
|
||||
|
||||
void SystemErr(int err);
|
||||
|
||||
void SaveLog();
|
||||
};
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ void PostMultiParser::CreateTmpFile()
|
|||
{
|
||||
char buf[100];
|
||||
|
||||
sprintf(buf, "/tmp/winix_%u_%d_%u", (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
sprintf(buf, "%s/winix_%u_%d_%u", data.static_auth_dir_tmp.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
tmp_filename_postfix += 1;
|
||||
|
||||
tmp_file.open(buf, std::ios_base::binary | std::ios_base::out);
|
||||
|
@ -542,7 +542,7 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTable & post_table_, PostFil
|
|||
post_table->clear();
|
||||
post_file_table->clear();
|
||||
|
||||
if( err != Error::input_too_large )
|
||||
if( err != Error::input_too_large && err != Error::cant_create_file )
|
||||
log << log1 << "PMP: syntax error" << logend;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue