static int helper_child(void *arg)
{
	struct helper_data *data = arg;
	char **argv = data->argv;
	int err;

	if (data->pre_exec != NULL)
		(*data->pre_exec)(data->pre_data);
	err = execvp_noalloc(data->buf, argv[0], argv);

	/* If the exec succeeds, we don't get here */
	write(data->fd, &err, sizeof(err));

	return 0;
}
Exemple #2
0
int main(int argc, char**argv)
{
    char buf[PATH_MAX];
    int ret;
    argc--;
    if (!argc) {
        fprintf(stderr, "Not enough arguments\n");
        return 1;
    }
    argv++;
    if (ret = execvp_noalloc(buf, argv[0], argv)) {
        errno = -ret;
        perror("execvp_noalloc");
    }
    return 0;
}