Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1736799d
Commit
1736799d
authored
Mar 12, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add map.c with shared p_mmap param validation
Forgot to add this file in the previous commit
parent
e1de726c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
src/map.c
+36
-0
No files found.
src/map.c
0 → 100644
View file @
1736799d
/*
* Copyright (C) 2009-2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#include <git2/common.h>
#include "map.h"
int
validate_map_args
(
git_map
*
out
,
size_t
len
,
int
prot
,
int
flags
,
int
fd
,
git_off_t
offset
)
{
GIT_UNUSED
(
fd
);
GIT_UNUSED
(
offset
);
if
(
out
==
NULL
||
len
==
0
)
{
errno
=
EINVAL
;
giterr_set
(
GITERR_OS
,
"Failed to mmap. No map or zero length"
);
return
-
1
;
}
if
(
!
(
prot
&
GIT_PROT_WRITE
)
&&
!
(
prot
&
GIT_PROT_READ
))
{
errno
=
EINVAL
;
giterr_set
(
GITERR_OS
,
"Failed to mmap. Invalid protection parameters"
);
return
-
1
;
}
if
(
flags
&
GIT_MAP_FIXED
)
{
errno
=
EINVAL
;
giterr_set
(
GITERR_OS
,
"Failed to mmap. FIXED not set"
);
return
-
1
;
}
return
0
;
}
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