Replace on_exit() call with atexit() call
authorNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 6 Dec 2015 04:19:26 +0000 (23:19 -0500)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Mon, 7 Dec 2015 03:59:24 +0000 (22:59 -0500)
The on_exit() function is non-portable and is not available
in all environments (notably Linux environments running on MUSL
and Solaris based environments). Thus, the function call is
swapped for the portable atexit() call.

src/createrepo_shared.c
src/createrepo_shared.h

index 63392d7840eeb14040842b9bc9f30166fe3aece3..5872029b027f7ec4c783782c5be6021bd301f3de 100644 (file)
@@ -84,7 +84,7 @@ cr_set_cleanup_handler(const char *lock_dir,
         global_tmp_out_repo = NULL;
 
     // Register on exit cleanup function
-    if (on_exit(failure_exit_cleanup, NULL))
+    if (atexit(failure_exit_cleanup))
         g_warning("Cannot set exit cleanup function by atexit()");
 
     // Prepare signal handler configuration
index 05abce773d867c939b5513d302422170dce004be..f709a2edf7166be4d64f541235deb90628c9d85f 100644 (file)
@@ -40,7 +40,7 @@ extern "C" {
 
 /**
  * This function does:
- * 1) Sets on_exit cleanup function that removes temporary directories
+ * 1) Sets atexit cleanup function that removes temporary directories
  * 2) Sets a signal handler for signals that lead to process temination.
  *    (List obtained from the "man 7 signal")
  *    Signals that are ignored (SIGCHILD) or lead just to stop (SIGSTOP, ...)