Signed-off-by: Tobias Ulmer <tu@emlix.com>
return 2;
}
- argv = malloc(argc * sizeof(char *));
+ argv = malloc((argc+1) * sizeof(char *));
if (argv == NULL) {
lua_pushboolean(L, 0);
lua_pushstring(L, "do_execvp: 1+ argv arguments required");
}
argv[i] = NULL;
-
-
execvp(file, argv);
- /* If it returns at all something is wrong */
+ /* If it returns, something is wrong */
free(argv);
lua_pushboolean(L, 0);
lua_pushstring(L, strerror(errno));