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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
26484ac9
Commit
26484ac9
authored
Oct 27, 2006
by
stewart@willster.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#22301 ndb: File_class::size() is not thread safe
parent
3dbc3247
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
ndb/include/logger/FileLogHandler.hpp
ndb/include/logger/FileLogHandler.hpp
+1
-1
ndb/include/util/File.hpp
ndb/include/util/File.hpp
+2
-2
ndb/src/common/util/File.cpp
ndb/src/common/util/File.cpp
+9
-10
No files found.
ndb/include/logger/FileLogHandler.hpp
View file @
26484ac9
...
@@ -102,7 +102,7 @@ private:
...
@@ -102,7 +102,7 @@ private:
bool
setMaxFiles
(
const
BaseString
&
files
);
bool
setMaxFiles
(
const
BaseString
&
files
);
int
m_maxNoFiles
;
int
m_maxNoFiles
;
long
m_maxFileSize
;
off_t
m_maxFileSize
;
unsigned
int
m_maxLogEntries
;
unsigned
int
m_maxLogEntries
;
File_class
*
m_pLogFile
;
File_class
*
m_pLogFile
;
};
};
...
...
ndb/include/util/File.hpp
View file @
26484ac9
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
* @param f a pointer to a FILE descriptor.
* @param f a pointer to a FILE descriptor.
* @return the size of the file.
* @return the size of the file.
*/
*/
static
long
size
(
FILE
*
f
);
static
off_t
size
(
FILE
*
f
);
/**
/**
* Renames a file.
* Renames a file.
...
@@ -182,7 +182,7 @@ public:
...
@@ -182,7 +182,7 @@ public:
*
*
* @return the file size.
* @return the file size.
*/
*/
long
size
()
const
;
off_t
size
()
const
;
/**
/**
* Returns the filename.
* Returns the filename.
...
...
ndb/src/common/util/File.cpp
View file @
26484ac9
...
@@ -45,17 +45,16 @@ File_class::exists(const char* aFileName)
...
@@ -45,17 +45,16 @@ File_class::exists(const char* aFileName)
return
(
my_stat
(
aFileName
,
&
stmp
,
MYF
(
0
))
!=
NULL
);
return
(
my_stat
(
aFileName
,
&
stmp
,
MYF
(
0
))
!=
NULL
);
}
}
long
off_t
File_class
::
size
(
FILE
*
f
)
File_class
::
size
(
FILE
*
f
)
{
{
long
cur_pos
=
0
,
length
=
0
;
MY_STAT
s
;
cur_pos
=
::
ftell
(
f
);
// Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
::
fseek
(
f
,
0
,
SEEK_END
);
if
(
my_fstat
(
::
fileno
(
f
),
&
s
,
MYF
(
0
)))
length
=
::
ftell
(
f
);
return
0
;
::
fseek
(
f
,
cur_pos
,
SEEK_SET
);
// restore original position
return
length
;
return
s
.
st_size
;
}
}
bool
bool
...
@@ -169,7 +168,7 @@ File_class::writeChar(const char* buf)
...
@@ -169,7 +168,7 @@ File_class::writeChar(const char* buf)
return
writeChar
(
buf
,
0
,
::
strlen
(
buf
));
return
writeChar
(
buf
,
0
,
::
strlen
(
buf
));
}
}
long
off_t
File_class
::
size
()
const
File_class
::
size
()
const
{
{
return
File_class
::
size
(
m_file
);
return
File_class
::
size
(
m_file
);
...
...
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