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
c6cf7f0e
Unverified
Commit
c6cf7f0e
authored
Jan 07, 2021
by
Edward Thomson
Committed by
GitHub
Jan 07, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5769 from lhchavez/pwrite-pread
Use `p_pwrite`/`p_pread` consistently throughout the codebase
parents
81c98af7
ff6f6754
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
11 deletions
+3
-11
src/indexer.c
+1
-3
src/midx.c
+1
-6
src/pack.c
+1
-2
No files found.
src/indexer.c
View file @
c6cf7f0e
...
...
@@ -656,7 +656,6 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
size_t
page_offset
;
off64_t
page_start
;
off64_t
current_size
=
idx
->
pack
->
mwf
.
size
;
int
fd
=
idx
->
pack
->
mwf
.
fd
;
int
error
;
if
(
!
size
)
...
...
@@ -673,8 +672,7 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
page_offset
=
new_size
%
mmap_alignment
;
page_start
=
new_size
-
page_offset
;
if
(
p_lseek
(
fd
,
page_start
+
mmap_alignment
-
1
,
SEEK_SET
)
<
0
||
p_write
(
idx
->
pack
->
mwf
.
fd
,
data
,
1
)
<
0
)
{
if
(
p_pwrite
(
idx
->
pack
->
mwf
.
fd
,
data
,
1
,
page_start
+
mmap_alignment
-
1
)
<
0
)
{
git_error_set
(
GIT_ERROR_OS
,
"cannot extend packfile '%s'"
,
idx
->
pack
->
pack_name
);
return
-
1
;
}
...
...
src/midx.c
View file @
c6cf7f0e
...
...
@@ -353,12 +353,7 @@ bool git_midx_needs_refresh(
return
true
;
}
if
(
p_lseek
(
fd
,
-
GIT_OID_RAWSZ
,
SEEK_END
)
<
0
)
{
p_close
(
fd
);
return
true
;
}
bytes_read
=
p_read
(
fd
,
&
idx_checksum
,
GIT_OID_RAWSZ
);
bytes_read
=
p_pread
(
fd
,
&
idx_checksum
,
GIT_OID_RAWSZ
,
st
.
st_size
-
GIT_OID_RAWSZ
);
p_close
(
fd
);
if
(
bytes_read
!=
GIT_OID_RAWSZ
)
...
...
src/pack.c
View file @
c6cf7f0e
...
...
@@ -1130,8 +1130,7 @@ static int packfile_open_locked(struct git_pack_file *p)
/* Verify the pack matches its index. */
if
(
p
->
num_objects
!=
ntohl
(
hdr
.
hdr_entries
)
||
p_lseek
(
p
->
mwf
.
fd
,
p
->
mwf
.
size
-
GIT_OID_RAWSZ
,
SEEK_SET
)
==
-
1
||
p_read
(
p
->
mwf
.
fd
,
sha1
.
id
,
GIT_OID_RAWSZ
)
<
0
)
p_pread
(
p
->
mwf
.
fd
,
sha1
.
id
,
GIT_OID_RAWSZ
,
p
->
mwf
.
size
-
GIT_OID_RAWSZ
)
<
0
)
goto
cleanup
;
idx_sha1
=
((
unsigned
char
*
)
p
->
index_map
.
data
)
+
p
->
index_map
.
len
-
40
;
...
...
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