- {
-#if defined __CYGWIN__
- /* cygwin-1.5.13 (2005-03-01) or newer would also allow a Linux-like
- implementation: readlink of "/proc/self/exe". But using the
- result of the Win32 system call is simpler and is consistent with the
- code in relocatable.c. */
- /* On Cygwin, we need to convert paths coming from Win32 system calls
- to the Unix-like slashified notation. */
- static char location_as_posix_path[2 * MAX_PATH];
- /* There's no error return defined for cygwin_conv_to_posix_path.
- See cygwin-api/func-cygwin-conv-to-posix-path.html.
- Does it overflow the buffer of expected size MAX_PATH or does it
- truncate the path? I don't know. Let's catch both. */
- cygwin_conv_to_posix_path (location, location_as_posix_path);
- location_as_posix_path[MAX_PATH - 1] = '\0';
- if (strlen (location_as_posix_path) >= MAX_PATH - 1)
- /* A sign of buffer overflow or path truncation. */
- return NULL;
- /* Call canonicalize_file_name, because Cygwin supports symbolic links. */
- return canonicalize_file_name (location_as_posix_path);
-#else
- return xstrdup (location);
-#endif
- }
-#else /* Unix && !Cygwin */
-#ifdef __linux__