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: ...@@ -191,10 +191,8 @@ public:
int flush() const; int flush() const;
private: private:
STATIC_CONST( MAX_FILE_NAME_SIZE = 128 );
FILE* m_file; FILE* m_file;
char m_fileName[MAX_FILE_NAME_SIZE]; char m_fileName[PATH_MAX];
const char* m_fileMode; const char* m_fileMode;
/* Prohibit */ /* Prohibit */
File_class (const File_class& aCopy); File_class (const File_class& aCopy);
......
...@@ -64,11 +64,11 @@ NdbConfig_NdbCfgName(int with_ndb_home){ ...@@ -64,11 +64,11 @@ NdbConfig_NdbCfgName(int with_ndb_home){
int len= 0; int len= 0;
if (with_ndb_home) { if (with_ndb_home) {
buf= NdbConfig_AllocHomePath(128); buf= NdbConfig_AllocHomePath(PATH_MAX);
len= strlen(buf); len= strlen(buf);
} else } else
buf= NdbMem_Allocate(128); buf= NdbMem_Allocate(PATH_MAX);
basestring_snprintf(buf+len, 128, "Ndb.cfg"); basestring_snprintf(buf+len, PATH_MAX, "Ndb.cfg");
return buf; return buf;
} }
...@@ -90,56 +90,56 @@ char *get_prefix_buf(int len, int node_id) ...@@ -90,56 +90,56 @@ char *get_prefix_buf(int len, int node_id)
char* char*
NdbConfig_ErrorFileName(int node_id){ 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); int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_error.log"); basestring_snprintf(buf+len, PATH_MAX, "_error.log");
return buf; return buf;
} }
char* char*
NdbConfig_ClusterLogFileName(int node_id){ 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); int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_cluster.log"); basestring_snprintf(buf+len, PATH_MAX, "_cluster.log");
return buf; return buf;
} }
char* char*
NdbConfig_SignalLogFileName(int node_id){ 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); int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_signal.log"); basestring_snprintf(buf+len, PATH_MAX, "_signal.log");
return buf; return buf;
} }
char* char*
NdbConfig_TraceFileName(int node_id, int file_no){ 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); 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; return buf;
} }
char* char*
NdbConfig_NextTraceFileName(int node_id){ 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); int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_trace.log.next"); basestring_snprintf(buf+len, PATH_MAX, "_trace.log.next");
return buf; return buf;
} }
char* char*
NdbConfig_PidFileName(int node_id){ 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); int len= strlen(buf);
basestring_snprintf(buf+len, 128, ".pid"); basestring_snprintf(buf+len, PATH_MAX, ".pid");
return buf; return buf;
} }
char* char*
NdbConfig_StdoutFileName(int node_id){ 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); int len= strlen(buf);
basestring_snprintf(buf+len, 128, "_out.log"); basestring_snprintf(buf+len, PATH_MAX, "_out.log");
return buf; return buf;
} }
...@@ -67,7 +67,7 @@ File_class::File_class(const char* aFileName, const char* mode) : ...@@ -67,7 +67,7 @@ File_class::File_class(const char* aFileName, const char* mode) :
m_file(NULL), m_file(NULL),
m_fileMode(mode) m_fileMode(mode)
{ {
BaseString::snprintf(m_fileName, MAX_FILE_NAME_SIZE, aFileName); BaseString::snprintf(m_fileName, PATH_MAX, aFileName);
} }
bool bool
...@@ -83,7 +83,7 @@ File_class::open(const char* aFileName, const char* mode) ...@@ -83,7 +83,7 @@ File_class::open(const char* aFileName, const char* mode)
/** /**
* Only copy if it's not the same string * 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; m_fileMode = mode;
bool rc = true; 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