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
274b2f8c
Commit
274b2f8c
authored
Mar 07, 2013
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix a bug causing the server to crash when writing on a memory mapped
file on Linux. modified: storage/connect/maputil.cpp
parent
44efd729
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
storage/connect/maputil.cpp
storage/connect/maputil.cpp
+16
-5
No files found.
storage/connect/maputil.cpp
View file @
274b2f8c
...
...
@@ -117,6 +117,7 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
MEMMAP
*
mm
,
MODE
mode
,
bool
del
)
{
unsigned
int
openMode
;
int
protmode
;
HANDLE
fd
;
size_t
filesize
;
struct
stat
st
;
...
...
@@ -127,13 +128,16 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
switch
(
mode
)
{
case
MODE_READ
:
openMode
=
O_RDONLY
;
protmode
=
PROT_READ
;
break
;
case
MODE_UPDATE
:
case
MODE_DELETE
:
openMode
=
(
del
)
?
(
O_RDWR
|
O_TRUNC
)
:
O_RDWR
;
protmode
=
PROT_WRITE
;
break
;
case
MODE_INSERT
:
openMode
=
(
O_WRONLY
|
O_CREAT
|
O_APPEND
);
protmode
=
PROT_WRITE
;
break
;
default:
sprintf
(
g
->
Message
,
MSG
(
BAD_FUNC_MODE
),
"CreateFileMap"
,
mode
);
...
...
@@ -155,9 +159,16 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
// Now we are ready to load the file. If mmap() is available we try
// this first. If not available or it failed we try to load it.
mm
->
memory
=
mmap
(
NULL
,
filesize
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
mm
->
memory
=
mmap
(
NULL
,
filesize
,
protmode
,
MAP_PRIVATE
,
fd
,
0
);
if
(
mm
->
memory
)
{
mm
->
lenL
=
(
mm
->
memory
!=
0
)
?
filesize
:
0
;
mm
->
lenH
=
0
;
}
else
{
strcpy
(
g
->
Message
,
"Memory mapping failed"
);
return
INVALID_HANDLE_VALUE
;
}
endif
// memory
}
/* endif fd */
// mmap() call was successful. ??????????
...
...
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