summaryrefslogtreecommitdiffstats
path: root/src/core/archive.c
diff options
context:
space:
mode:
authorSimon Rettberg2026-01-28 12:53:53 +0100
committerSimon Rettberg2026-01-28 12:53:53 +0100
commit8e82785c584dc13e20f9229decb95bd17bbe9cd1 (patch)
treea8b359e59196be5b2e3862bed189107f4bc9975f /src/core/archive.c
parentMerge branch 'master' into openslx (diff)
parent[prefix] Make unlzma.S compatible with 386 class CPUs (diff)
downloadipxe-openslx.tar.gz
ipxe-openslx.tar.xz
ipxe-openslx.zip
Merge branch 'master' into openslxopenslx
Diffstat (limited to 'src/core/archive.c')
-rw-r--r--src/core/archive.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/archive.c b/src/core/archive.c
index bb62c7e47..8b6accc6a 100644
--- a/src/core/archive.c
+++ b/src/core/archive.c
@@ -43,7 +43,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
int image_extract ( struct image *image, const char *name,
struct image **extracted ) {
- char *dot;
int rc;
/* Check that this image can be used to extract an archive image */
@@ -66,10 +65,8 @@ int image_extract ( struct image *image, const char *name,
}
/* Strip any archive or compression suffix from implicit name */
- if ( ( ! name ) && ( (*extracted)->name ) &&
- ( ( dot = strrchr ( (*extracted)->name, '.' ) ) != NULL ) ) {
- *dot = '\0';
- }
+ if ( ! name )
+ image_strip_suffix ( *extracted );
/* Try extracting archive image */
if ( ( rc = image->type->extract ( image, *extracted ) ) != 0 ) {
@@ -122,9 +119,14 @@ int image_extract_exec ( struct image *image ) {
/* Set auto-unregister flag */
extracted->flags |= IMAGE_AUTO_UNREGISTER;
- /* Tail-recurse into extracted image */
- return image_exec ( extracted );
+ /* Replace current image */
+ if ( ( rc = image_replace ( extracted ) ) != 0 )
+ goto err_replace;
+
+ /* Return to allow replacement image to be executed */
+ return 0;
+ err_replace:
err_set_cmdline:
unregister_image ( extracted );
err_extract: