Navigation Menu

Skip to content

Commit

Permalink
Check chdir() return codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 30, 2009
1 parent c272ccb commit b2dd052
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions platform_unix.c
Expand Up @@ -1198,9 +1198,12 @@ boolean xdgDesktopMenuItem(const char *action, const char *data)
char *fname = cpy + ((size_t)(ptr-data));
const char *argv[] = { action, fname+1, NULL };
*(fname++) = '\0';
chdir(cpy);
retval = unix_launchXdgUtil("xdg-desktop-menu", argv);
chdir(working_dir);
if (chdir(cpy) == 0)
{
retval = unix_launchXdgUtil("xdg-desktop-menu", argv);
if (chdir(working_dir) == -1) // deep trouble!
fatal("Failed to chdir to '%0'", working_dir);
} // if
free(cpy);
free(working_dir);
} // if
Expand Down

0 comments on commit b2dd052

Please sign in to comment.