Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
apk-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
62
Issues
62
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
apk-tools
Commits
ce3cf8bf
Commit
ce3cf8bf
authored
Jun 01, 2010
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db, pkg: fix triggers related crash
clean up the triggers properly, in proper order.
parent
440cffef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
src/database.c
src/database.c
+10
-8
src/package.c
src/package.c
+1
-0
No files found.
src/database.c
View file @
ce3cf8bf
...
...
@@ -831,7 +831,8 @@ static void apk_db_triggers_write(struct apk_database *db, struct apk_ostream *o
list_for_each_entry
(
ipkg
,
&
db
->
installed
.
triggers
,
trigger_pkgs_list
)
{
bfn
=
APK_BLOB_BUF
(
buf
);
apk_blob_push_csum
(
&
bfn
,
&
ipkg
->
pkg
->
csum
);
os
->
write
(
os
,
buf
,
bfn
.
ptr
-
buf
);
bfn
=
apk_blob_pushed
(
APK_BLOB_BUF
(
buf
),
bfn
);
os
->
write
(
os
,
bfn
.
ptr
,
bfn
.
len
);
for
(
i
=
0
;
i
<
ipkg
->
triggers
->
num
;
i
++
)
{
os
->
write
(
os
,
" "
,
1
);
...
...
@@ -1269,8 +1270,8 @@ void apk_db_close(struct apk_database *db)
if
(
db
->
world
)
free
(
db
->
world
);
apk_hash_free
(
&
db
->
available
.
names
);
apk_hash_free
(
&
db
->
available
.
packages
);
apk_hash_free
(
&
db
->
available
.
names
);
apk_hash_free
(
&
db
->
installed
.
files
);
apk_hash_free
(
&
db
->
installed
.
dirs
);
...
...
@@ -2106,12 +2107,6 @@ int apk_db_install_pkg(struct apk_database *db,
/* Install the new stuff */
ipkg
=
apk_pkg_install
(
db
,
newpkg
);
ipkg
->
flags
|=
APK_IPKGF_RUN_ALL_TRIGGERS
;
if
(
ipkg
->
triggers
)
{
list_del
(
&
ipkg
->
trigger_pkgs_list
);
free
(
ipkg
->
triggers
);
ipkg
->
triggers
=
NULL
;
}
if
(
newpkg
->
installed_size
!=
0
)
{
r
=
apk_db_unpack_pkg
(
db
,
ipkg
,
(
oldpkg
!=
NULL
),
(
oldpkg
==
newpkg
),
cb
,
cb_ctx
,
...
...
@@ -2122,6 +2117,13 @@ int apk_db_install_pkg(struct apk_database *db,
}
}
ipkg
->
flags
|=
APK_IPKGF_RUN_ALL_TRIGGERS
;
if
(
ipkg
->
triggers
)
{
list_del
(
&
ipkg
->
trigger_pkgs_list
);
free
(
ipkg
->
triggers
);
ipkg
->
triggers
=
NULL
;
}
if
(
oldpkg
!=
NULL
&&
oldpkg
!=
newpkg
&&
oldpkg
->
ipkg
!=
NULL
)
{
apk_db_purge_pkg
(
db
,
oldpkg
->
ipkg
,
NULL
);
apk_pkg_uninstall
(
db
,
oldpkg
);
...
...
src/package.c
View file @
ce3cf8bf
...
...
@@ -92,6 +92,7 @@ void apk_pkg_uninstall(struct apk_database *db, struct apk_package *pkg)
if
(
ipkg
->
triggers
)
{
list_del
(
&
ipkg
->
trigger_pkgs_list
);
list_init
(
&
ipkg
->
trigger_pkgs_list
);
for
(
i
=
0
;
i
<
ipkg
->
triggers
->
num
;
i
++
)
free
(
ipkg
->
triggers
->
item
[
i
]);
free
(
ipkg
->
triggers
);
...
...
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