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

Commit 7fe79165 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Revert "init: Implement exec support"

This reverts commit 2f0ed0d3.

Change-Id: Ia0754c913da3d20c4e0c207ca479c043d394944e
parent 299c6048
Loading
Loading
Loading
Loading
+1 −35
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
#include <linux/kd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <linux/if.h>
#include <arpa/inet.h>
@@ -259,43 +258,10 @@ int do_domainname(int nargs, char **args)
    return write_file("/proc/sys/kernel/domainname", args[1]);
}

/*exec <path> <arg1> <arg2> ... */
#define MAX_PARAMETERS 64
int do_exec(int nargs, char **args)
{
    pid_t pid;
    int status, i, j;
    char *par[MAX_PARAMETERS];
    if (nargs > MAX_PARAMETERS)
{
    return -1;
}
    for(i=0, j=1; i<(nargs-1) ;i++,j++)
    {
        par[i] = args[j];
    }
    par[i] = (char*)0;
    pid = fork();
    if (!pid)
    {
        char tmp[32];
        int fd, sz;
        get_property_workspace(&fd, &sz);
        sprintf(tmp, "%d,%d", dup(fd), sz);
        setenv("ANDROID_PROPERTY_WORKSPACE", tmp, 1);
        execve(par[0],par,environ);
        exit(0);
    }
    else
    {
        while (waitpid(pid, &status, 0) == -1 && errno == EINTR);
        if (WEXITSTATUS(status) != 0) {
            ERROR("exec: pid %1d exited with return code %d: %s", (int)pid, WEXITSTATUS(status), strerror(status));
        }

    }
    return 0;
}

int do_export(int nargs, char **args)
{