Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
eda5c319
Commit
eda5c319
authored
Sep 21, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug#5617
allow blank lines in Ndb.cfg files
parent
ee75c45d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
ndb/src/common/mgmcommon/LocalConfig.cpp
ndb/src/common/mgmcommon/LocalConfig.cpp
+24
-22
No files found.
ndb/src/common/mgmcommon/LocalConfig.cpp
View file @
eda5c319
...
...
@@ -229,10 +229,10 @@ LocalConfig::parseString(const char * connectString, char *line){
bool
LocalConfig
::
readFile
(
const
char
*
filename
,
bool
&
fopenError
)
{
char
line
[
1
50
],
line2
[
150
];
char
line
[
1
024
];
fopenError
=
false
;
FILE
*
file
=
fopen
(
filename
,
"r"
);
if
(
file
==
0
){
snprintf
(
line
,
150
,
"Unable to open local config file: %s"
,
filename
);
...
...
@@ -241,31 +241,33 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
return
false
;
}
unsigned
int
sz
=
1024
;
char
*
theString
=
(
char
*
)
NdbMem_Allocate
(
sz
);
theString
[
0
]
=
0
;
fgets
(
theString
,
sz
,
file
);
while
(
fgets
(
line
+
1
,
100
,
file
))
{
line
[
0
]
=
';'
;
while
(
strlen
(
theString
)
+
strlen
(
line
)
>=
sz
)
{
sz
=
sz
*
2
;
char
*
newString
=
(
char
*
)
NdbMem_Allocate
(
sz
);
strcpy
(
newString
,
theString
);
free
(
theString
);
theString
=
newString
;
BaseString
theString
;
while
(
fgets
(
line
,
1024
,
file
)){
BaseString
tmp
(
line
);
tmp
.
trim
(
"
\t\n\r
"
);
if
(
tmp
.
length
()
>
0
&&
tmp
.
c_str
()[
0
]
!=
'#'
){
theString
.
append
(
tmp
);
break
;
}
strcat
(
theString
,
line
);
}
bool
return_value
=
parseString
(
theString
,
line
);
while
(
fgets
(
line
,
1024
,
file
))
{
BaseString
tmp
(
line
);
tmp
.
trim
(
"
\t\n\r
"
);
if
(
tmp
.
length
()
>
0
&&
tmp
.
c_str
()[
0
]
!=
'#'
){
theString
.
append
(
";"
);
theString
.
append
(
tmp
);
}
}
bool
return_value
=
parseString
(
theString
.
c_str
(),
line
);
if
(
!
return_value
)
{
snprintf
(
line2
,
150
,
"Reading %s: %s"
,
filename
,
line
);
setError
(
0
,
line2
);
BaseString
tmp
;
tmp
.
assfmt
(
"Reading %s: %s"
,
filename
,
line
);
setError
(
0
,
tmp
.
c_str
());
}
free
(
theString
);
fclose
(
file
);
return
return_value
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment