Check getcwd return in X11 platform main.
This commit is contained in:
parent
67177586d3
commit
f8020bc976
1 changed files with 3 additions and 2 deletions
|
@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
|
|||
setlocale(LC_CTYPE, "");
|
||||
|
||||
char *cwd = (char *)malloc(PATH_MAX);
|
||||
getcwd(cwd, PATH_MAX);
|
||||
char *ret = getcwd(cwd, PATH_MAX);
|
||||
|
||||
Error err = Main::setup(argv[0], argc - 1, &argv[1]);
|
||||
if (err != OK) {
|
||||
|
@ -55,6 +55,7 @@ int main(int argc, char *argv[]) {
|
|||
os.run(); // it is actually the OS that decides how to run
|
||||
Main::cleanup();
|
||||
|
||||
if (ret)
|
||||
chdir(cwd);
|
||||
free(cwd);
|
||||
|
||||
|
|
Loading…
Reference in a new issue