Commit e5029898 authored by stewart@mysql.com's avatar stewart@mysql.com

BUG#17411 cannot have path longer than 128 characters

Use the POSIX limits.h define of PATH_MAX for maximum path length.

This has been being hit in pushbuild
parent 131217eb
......@@ -191,10 +191,8 @@ public:
int flush() const;
private:
STATIC_CONST( MAX_FILE_NAME_SIZE = 128 );
FILE* m_file;
char m_fileName[MAX_FILE_NAME_SIZE];
char m_fileName[PATH_MAX];
const char* m_fileMode;
/* Prohibit */
File_class (const File_class& aCopy);
......
......@@ -64,11 +64,11 @@ NdbConfig_NdbCfgName(int with_ndb_home){
int len= 0;
if (with_ndb_home) {
buf= NdbConfig_AllocHomePath(128);
buf= NdbConfig_AllocHomePath(PATH_MAX);
len= strlen(buf);
} else
buf= NdbMem_Allocate(128);
basestring_snprintf(buf+len, 128, "Ndb.cfg");
buf= NdbMem_Allocate(PATH_MAX);
basestring_snprintf(buf+len, PATH_MAX, "Ndb.cfg");
return buf;
}
......@@ -90,56 +90,56 @@ char *get_prefix_buf(int len, int node_id)
char*
NdbConfig_ErrorFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_error.log");
basestring_snprintf(buf+len, PATH_MAX, "_error.log");
return buf;
}
char*
NdbConfig_ClusterLogFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_cluster.log");
basestring_snprintf(buf+len, PATH_MAX, "_cluster.log");
return buf;
}
char*
NdbConfig_SignalLogFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_signal.log");
basestring_snprintf(buf+len, PATH_MAX, "_signal.log");
return buf;
}
char*
NdbConfig_TraceFileName(int node_id, int file_no){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_trace.log.%u", file_no);
basestring_snprintf(buf+len, PATH_MAX, "_trace.log.%u", file_no);
return buf;
}
char*
NdbConfig_NextTraceFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_trace.log.next");
basestring_snprintf(buf+len, PATH_MAX, "_trace.log.next");
return buf;
}
char*
NdbConfig_PidFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, ".pid");
basestring_snprintf(buf+len, PATH_MAX, ".pid");
return buf;
}
char*
NdbConfig_StdoutFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
char *buf= get_prefix_buf(PATH_MAX, node_id);
int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_out.log");
basestring_snprintf(buf+len, PATH_MAX, "_out.log");
return buf;
}
......@@ -67,7 +67,7 @@ File_class::File_class(const char* aFileName, const char* mode) :
m_file(NULL),
m_fileMode(mode)
{
BaseString::snprintf(m_fileName, MAX_FILE_NAME_SIZE, aFileName);
BaseString::snprintf(m_fileName, PATH_MAX, aFileName);
}
bool
......@@ -83,7 +83,7 @@ File_class::open(const char* aFileName, const char* mode)
/**
* Only copy if it's not the same string
*/
BaseString::snprintf(m_fileName, MAX_FILE_NAME_SIZE, aFileName);
BaseString::snprintf(m_fileName, PATH_MAX, aFileName);
}
m_fileMode = mode;
bool rc = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment