mirror of
https://github.com/OpenVPN/openvpn.git
synced 2024-09-20 20:03:13 +02:00
plugins, down-root: Code style clean-up
The coding style was somewhat chaotic. Cleaning it up using the astyle tool. The style parameters are coherent to what was agreed upon at the Munich Hackathon 2014 [1]. astyle --style=allman --indent=spaces=4 -c Also included a "Local variables" section which some editors may pick up automatically. Signed-off-by: David Sommerseth <davids@redhat.com> Acked-by: Steffan Karger <steffan.karger@fox-it.com> Message-Id: <1418078751-3614-1-git-send-email-openvpn.list@topphemmelig.net> URL: http://article.gmane.org/gmane.network.openvpn.devel/9331 Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
706283d376
commit
e2e9a69c1e
@ -229,20 +229,27 @@ free_context (struct down_root_context *context)
|
||||
* calling execve()
|
||||
*/
|
||||
static int
|
||||
run_script(char * const *argv, char * const *envp) {
|
||||
run_script(char * const *argv, char * const *envp)
|
||||
{
|
||||
pid_t pid;
|
||||
int ret = 0;
|
||||
|
||||
pid = fork();
|
||||
if (pid == (pid_t)0) { /* child side */
|
||||
if (pid == (pid_t)0) /* child side */
|
||||
{
|
||||
execve(argv[0], argv, envp);
|
||||
/* If execve() fails to run, exit child with exit code 127 */
|
||||
err(127, "DOWN-ROOT: Failed execute: %s", argv[0]);
|
||||
} else if (pid < (pid_t)0 ){
|
||||
}
|
||||
else if (pid < (pid_t)0 )
|
||||
{
|
||||
warn ("DOWN-ROOT: Failed to fork child to run %s", argv[0]);
|
||||
return -1;
|
||||
} else { /* parent side */
|
||||
if( waitpid (pid, &ret, 0) != pid ) {
|
||||
}
|
||||
else /* parent side */
|
||||
{
|
||||
if( waitpid (pid, &ret, 0) != pid )
|
||||
{
|
||||
/* waitpid does not return error information via errno */
|
||||
fprintf(stderr, "DOWN-ROOT: waitpid() failed, don't know exit code of child (%s)\n", argv[0]);
|
||||
return -1;
|
||||
@ -310,7 +317,7 @@ openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char
|
||||
|
||||
return (openvpn_plugin_handle_t) context;
|
||||
|
||||
error:
|
||||
error:
|
||||
free_context (context);
|
||||
return NULL;
|
||||
}
|
||||
@ -523,9 +530,18 @@ down_root_server (const int fd, char * const *argv, char * const *envp, const in
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
if (DEBUG (verb))
|
||||
fprintf (stderr, "DOWN-ROOT: BACKGROUND: EXIT\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
c-file-style: "bsd"
|
||||
c-basic-offset: 4
|
||||
indent-tabs-mode: nil
|
||||
End:
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user