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()
|
* calling execve()
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
run_script(char * const *argv, char * const *envp) {
|
run_script(char * const *argv, char * const *envp)
|
||||||
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == (pid_t)0) { /* child side */
|
if (pid == (pid_t)0) /* child side */
|
||||||
|
{
|
||||||
execve(argv[0], argv, envp);
|
execve(argv[0], argv, envp);
|
||||||
/* If execve() fails to run, exit child with exit code 127 */
|
/* If execve() fails to run, exit child with exit code 127 */
|
||||||
err(127, "DOWN-ROOT: Failed execute: %s", argv[0]);
|
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]);
|
warn ("DOWN-ROOT: Failed to fork child to run %s", argv[0]);
|
||||||
return -1;
|
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 */
|
/* 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]);
|
fprintf(stderr, "DOWN-ROOT: waitpid() failed, don't know exit code of child (%s)\n", argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
@ -529,3 +536,12 @@ down_root_server (const int fd, char * const *argv, char * const *envp, const in
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Local variables:
|
||||||
|
c-file-style: "bsd"
|
||||||
|
c-basic-offset: 4
|
||||||
|
indent-tabs-mode: nil
|
||||||
|
End:
|
||||||
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user