Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4c52338 authored by Steve Kondik's avatar Steve Kondik Committed by Giulio Cervera
Browse files

Fix do_exec.

parent 19e1ad62
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <linux/loop.h>

#include "init.h"
@@ -186,11 +187,16 @@ int do_exec(int nargs, char **args)
    pid = fork();
    if (!pid)
    {
        execv(par[0],par);
        execvp(par[0],par);
	exit(0);
    }
    else
    {
        while(wait(&status)!=pid);
        waitpid(pid, &status, 0);
        if (WEXITSTATUS(status) != 0) {
        	ERROR("exec: pid %1d exited with return code %d: %s", (int)pid, WEXITSTATUS(status), strerror(status));
        }
        
    }
    return 0;
}