summaryrefslogtreecommitdiff
path: root/tools/msm_execute_helper.c
blob: bf348e2b4510d21b1fcd9ffe96ced977a11f18a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <glib.h>

int main(int argc, char* argv[])
{
    gchar **argv_modified = g_new0 (gchar *, (size_t)(argc + 1));
    memcpy (argv_modified, argv, (size_t)(argc) * sizeof (char*));
    argv_modified[0] = COMMAND;
    int errsv = 0;

    if (execvp (COMMAND, argv_modified) == -1) {
        errsv = errno;
    }

    g_free (argv_modified);
    return errsv;
}