Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
apk-tools
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
39
Issues
39
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
alpine
apk-tools
Commits
3490ff78
Commit
3490ff78
authored
Apr 13, 2015
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tee io error handling
use ERR_PTR mechanism, and handle it at all places.
parent
43955329
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
database.c
src/database.c
+1
-1
io.c
src/io.c
+5
-3
No files found.
src/database.c
View file @
3490ff78
...
...
@@ -2586,7 +2586,7 @@ static int apk_db_unpack_pkg(struct apk_database *db,
apk_blob_push_blob
(
&
b
,
tmpprefix
);
apk_pkg_format_cache_pkg
(
b
,
pkg
);
cache_bs
=
apk_bstream_tee
(
bs
,
db
->
cache_fd
,
tmpcacheitem
,
NULL
,
NULL
);
if
(
cache_bs
!=
NULL
)
if
(
!
IS_ERR_OR_NULL
(
cache_bs
)
)
bs
=
cache_bs
;
else
apk_warning
(
PKG_VER_FMT
": unable to cache: %s"
,
...
...
src/io.c
View file @
3490ff78
...
...
@@ -421,22 +421,24 @@ static void tee_close(void *stream, size_t *size)
struct
apk_bstream
*
apk_bstream_tee
(
struct
apk_bstream
*
from
,
int
atfd
,
const
char
*
to
,
apk_progress_cb
cb
,
void
*
cb_ctx
)
{
struct
apk_tee_bstream
*
tbs
;
int
fd
;
int
fd
,
r
;
if
(
IS_ERR_OR_NULL
(
from
))
return
ERR_CAST
(
from
);
fd
=
openat
(
atfd
,
to
,
O_CREAT
|
O_RDWR
|
O_TRUNC
|
O_CLOEXEC
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IROTH
);
if
(
fd
<
0
)
{
r
=
errno
;
from
->
close
(
from
,
NULL
);
return
NULL
;
return
ERR_PTR
(
-
r
)
;
}
tbs
=
malloc
(
sizeof
(
struct
apk_tee_bstream
));
if
(
!
tbs
)
{
r
=
errno
;
close
(
fd
);
from
->
close
(
from
,
NULL
);
return
NULL
;
return
ERR_PTR
(
-
r
)
;
}
tbs
->
bs
=
(
struct
apk_bstream
)
{
...
...
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