2010-07-02 Ulrich Weigand <uweigand@de.ibm.com>
[binutils-gdb.git] / gdb / remote-fileio.c
index d7215fe605b00e9e2d41c063d59e901bd8290599..82a4fe920d7ff3687d9259bb6cbc972ab64f9fbc 100644 (file)
 #include <sys/time.h>
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>                /* For cygwin_conv_to_full_posix_path.  */
+#include <cygwin/version.h>
+#if CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API_MINOR) < 181
+# define CCP_POSIX_TO_WIN_A 0
+# define CCP_WIN_A_TO_POSIX 2
+# define cygwin_conv_path(op, from, to, size)  \
+         (op == CCP_WIN_A_TO_POSIX) ? \
+         cygwin_conv_to_full_posix_path (from, to) : \
+         cygwin_conv_to_win32_path (from, to)
+#endif
 #endif
 #include <signal.h>
 
@@ -100,6 +109,7 @@ static int
 remote_fileio_fd_to_targetfd (int fd)
 {
   int target_fd = remote_fileio_next_free_fd ();
+
   remote_fio_data.fd_map[target_fd] = fd;
   return target_fd;
 }
@@ -1021,12 +1031,14 @@ remote_fileio_func_rename (char *buf)
                errno = EISDIR;
              else
                {
-                 char oldfullpath[PATH_MAX + 1];
-                 char newfullpath[PATH_MAX + 1];
+                 char oldfullpath[PATH_MAX];
+                 char newfullpath[PATH_MAX];
                  int len;
 
-                 cygwin_conv_to_full_posix_path (oldpath, oldfullpath);
-                 cygwin_conv_to_full_posix_path (newpath, newfullpath);
+                 cygwin_conv_path (CCP_WIN_A_TO_POSIX, oldpath, oldfullpath,
+                                   PATH_MAX);
+                 cygwin_conv_path (CCP_WIN_A_TO_POSIX, newpath, newfullpath,
+                                   PATH_MAX);
                  len = strlen (oldfullpath);
                  if (newfullpath[len] == '/'
                      && !strncmp (oldfullpath, newfullpath, len))
@@ -1466,6 +1478,7 @@ set_system_call_allowed (char *args, int from_tty)
     {
       char *arg_end;
       int val = strtoul (args, &arg_end, 10);
+
       if (*args && *arg_end == '\0')
         {
          remote_fio_system_call_allowed = !!val;