Fix for old libc version on bionic. Old versions would crash if the second argument was NULL.

This commit is contained in:
Ryan Houdek 2013-09-04 02:04:31 -05:00
parent 1ea8b93667
commit d0d053a9f9
1 changed files with 2 additions and 6 deletions

View File

@ -214,7 +214,8 @@ bool cdio_is_cdrom(std::string device)
#ifdef __linux__ #ifdef __linux__
// Resolve symbolic links. This allows symbolic links to valid // Resolve symbolic links. This allows symbolic links to valid
// drives to be passed from the command line with the -e flag. // drives to be passed from the command line with the -e flag.
char *devname = realpath(device.c_str(), NULL); char resolved_path[MAX_PATH];
char *devname = realpath(device.c_str(), resolved_path);
if (!devname) if (!devname)
return false; return false;
#endif #endif
@ -234,11 +235,6 @@ bool cdio_is_cdrom(std::string device)
} }
} }
#ifdef __linux__
if (devname)
free(devname);
#endif
devices.clear(); devices.clear();
return res; return res;
} }