diff mbox

pflash: use atexit for musl compatibility

Message ID 1469425820-16758-1-git-send-email-joel@jms.id.au
State Accepted
Headers show

Commit Message

Joel Stanley July 25, 2016, 5:50 a.m. UTC
I accidentally built myself a cross-toolchain with the musl libc. It does
not support on_exit which we use to clean up in pflash.

Instead use atexit with is supported by both uclibc, musl and glibc.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 external/pflash/pflash.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Stewart Smith July 28, 2016, 4:41 a.m. UTC | #1
Joel Stanley <joel@jms.id.au> writes:
> I accidentally built myself a cross-toolchain with the musl libc. It does
> not support on_exit which we use to clean up in pflash.
>
> Instead use atexit with is supported by both uclibc, musl and glibc.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Thanks, merged to master as of 72c551ff9d163a65087ca0865e736456f291995a
diff mbox

Patch

diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index c124356fd3d9..27000469052e 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -509,7 +509,7 @@  static void print_help(const char *pname)
 	printf("\t\tThis message.\n\n");
 }
 
-void exiting(int d, void *p)
+void exiting(void)
 {
 	if (need_relock)
 		arch_flash_set_wrprotect(bl, 1);
@@ -775,8 +775,7 @@  int main(int argc, char *argv[])
 		exit(1);
 	}
 
-	on_exit(exiting, NULL);
-
+	atexit(exiting);
 
 	rc = blocklevel_get_info(bl, &fl_name,
 			    &fl_total_size, &fl_erase_granule);