Commit eceb4fc9 authored by Colin Watson's avatar Colin Watson
Browse files

Use _exit rather than exit in pipecmd_exec

This avoids bugs such as functions registered using atexit being called
multiple times.

* lib/pipeline.c (pipecmd_exec): Call _exit rather than exit.
* NEWS: Document this.
parent cc764093
libpipeline 1.5.2
=================
`pipecmd_exec' now calls `_exit' rather than `exit', to avoid bugs such as
functions registered using `atexit' being called multiple times.
libpipeline 1.5.1 (27 January 2019)
===================================
......
......@@ -820,7 +820,7 @@ void pipecmd_exec (pipecmd *cmd)
cmdf->free_func (cmdf->data);
if (cmd->pre_exec_free_func)
cmd->pre_exec_free_func (cmd->pre_exec_data);
exit (0);
_exit (0);
}
case PIPECMD_SEQUENCE: {
......@@ -897,12 +897,12 @@ void pipecmd_exec (pipecmd *cmd)
if (WIFSIGNALED (status)) {
raise (WTERMSIG (status));
exit (1); /* just to make sure */
_exit (1); /* just to make sure */
} else if (status && WIFEXITED (status))
exit (WEXITSTATUS (status));
_exit (WEXITSTATUS (status));
}
exit (0);
_exit (0);
}
}
......@@ -910,7 +910,7 @@ void pipecmd_exec (pipecmd *cmd)
/* Never called, but gcc doesn't realise that error with non-zero
* status always exits.
*/
exit (EXEC_FAILED_EXIT_STATUS);
_exit (EXEC_FAILED_EXIT_STATUS);
}
void pipecmd_free (pipecmd *cmd)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment