Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
apk-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
socksinspace
apk-tools
Commits
b523beb3
Commit
b523beb3
authored
7 months ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
adbsign: fix error handling
parent
0e90ea6d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#251936
passed
7 months ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/apk_io.h
+5
-0
5 additions, 0 deletions
src/apk_io.h
src/app_adbsign.c
+18
-6
18 additions, 6 deletions
src/app_adbsign.c
with
23 additions
and
6 deletions
src/apk_io.h
+
5
−
0
View file @
b523beb3
...
...
@@ -182,6 +182,11 @@ static inline int apk_ostream_close(struct apk_ostream *os)
int
rc
=
os
->
rc
;
return
os
->
ops
->
close
(
os
)
?:
rc
;
}
static
inline
int
apk_ostream_close_error
(
struct
apk_ostream
*
os
,
int
r
)
{
apk_ostream_cancel
(
os
,
r
);
return
apk_ostream_close
(
os
);
}
int
apk_blob_from_istream
(
struct
apk_istream
*
is
,
size_t
size
,
apk_blob_t
*
b
);
int
apk_blob_from_file
(
int
atfd
,
const
char
*
file
,
apk_blob_t
*
b
);
...
...
This diff is collapsed.
Click to expand it.
src/app_adbsign.c
+
18
−
6
View file @
b523beb3
...
...
@@ -74,6 +74,22 @@ static int process_block(struct adb *db, struct adb_block *blk, struct apk_istre
return
0
;
}
static
int
adbsign_resign
(
struct
sign_ctx
*
ctx
,
struct
apk_istream
*
is
,
struct
apk_ostream
*
os
)
{
int
r
;
if
(
IS_ERR
(
os
))
{
apk_istream_close
(
is
);
return
PTR_ERR
(
os
);
}
ctx
->
os
=
os
;
memset
(
&
ctx
->
vfy
,
0
,
sizeof
ctx
->
vfy
);
r
=
adb_m_process
(
&
ctx
->
db
,
is
,
0
,
&
ctx
->
ac
->
trust
,
process_block
);
if
(
r
==
0
)
r
=
process_signatures
(
ctx
);
adb_free
(
&
ctx
->
db
);
return
apk_ostream_close_error
(
os
,
r
);
}
static
int
adbsign_main
(
void
*
pctx
,
struct
apk_ctx
*
ac
,
struct
apk_string_array
*
args
)
{
struct
apk_out
*
out
=
&
ac
->
out
;
...
...
@@ -84,13 +100,9 @@ static int adbsign_main(void *pctx, struct apk_ctx *ac, struct apk_string_array
ctx
->
ac
=
ac
;
foreach_array_item
(
arg
,
args
)
{
memset
(
&
ctx
->
vfy
,
0
,
sizeof
ctx
->
vfy
);
struct
apk_istream
*
is
=
adb_decompress
(
apk_istream_from_file_mmap
(
AT_FDCWD
,
*
arg
),
&
spec
);
ctx
->
os
=
adb_compress
(
apk_ostream_to_file
(
AT_FDCWD
,
*
arg
,
0644
),
&
spec
);
apk_ostream_cancel
(
ctx
->
os
,
adb_m_process
(
&
ctx
->
db
,
is
,
0
,
0
,
process_block
));
apk_ostream_cancel
(
ctx
->
os
,
process_signatures
(
ctx
));
adb_free
(
&
ctx
->
db
);
r
=
apk_ostream_close
(
ctx
->
os
);
struct
apk_ostream
*
os
=
adb_compress
(
apk_ostream_to_file
(
AT_FDCWD
,
*
arg
,
0644
),
&
spec
);
r
=
adbsign_resign
(
ctx
,
is
,
os
);
if
(
r
)
apk_err
(
out
,
"%s: %s"
,
*
arg
,
apk_error_str
(
r
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment