Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
82c44208
Commit
82c44208
authored
Apr 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedump: Avoid using mmap().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
015f31fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
16 deletions
+3
-16
dump.c
tools/winedump/dump.c
+3
-16
No files found.
tools/winedump/dump.c
View file @
82c44208
...
...
@@ -34,9 +34,6 @@
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <fcntl.h>
#include "windef.h"
...
...
@@ -260,13 +257,8 @@ BOOL dump_analysis(const char *name, file_dumper fn, enum FileSig wanted_sig)
if
(
fstat
(
fd
,
&
s
)
<
0
)
fatal
(
"Can't get size"
);
dump_total_len
=
s
.
st_size
;
#ifdef HAVE_MMAP
if
((
dump_base
=
mmap
(
NULL
,
dump_total_len
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
))
==
(
void
*
)
-
1
)
#endif
{
if
(
!
(
dump_base
=
malloc
(
dump_total_len
)))
fatal
(
"Out of memory"
);
if
((
unsigned
long
)
read
(
fd
,
dump_base
,
dump_total_len
)
!=
dump_total_len
)
fatal
(
"Cannot read file"
);
}
if
(
!
(
dump_base
=
malloc
(
dump_total_len
)))
fatal
(
"Out of memory"
);
if
((
unsigned
long
)
read
(
fd
,
dump_base
,
dump_total_len
)
!=
dump_total_len
)
fatal
(
"Cannot read file"
);
printf
(
"Contents of %s: %ld bytes
\n\n
"
,
name
,
dump_total_len
);
...
...
@@ -286,12 +278,7 @@ BOOL dump_analysis(const char *name, file_dumper fn, enum FileSig wanted_sig)
}
if
(
ret
)
printf
(
"Done dumping %s
\n
"
,
name
);
#ifdef HAVE_MMAP
if
(
munmap
(
dump_base
,
dump_total_len
)
==
-
1
)
#endif
{
free
(
dump_base
);
}
free
(
dump_base
);
close
(
fd
);
return
ret
;
...
...
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