Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* fix build error on MinGW (HAVE_READLINK) undefined
@ 2012-01-27  3:20 asmwarrior
  2012-01-27  9:41 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: asmwarrior @ 2012-01-27  3:20 UTC (permalink / raw)
  To: gdb-patches

Not sure the patch is correct, but it do build OK now.

  gdb/gdbserver/hostio.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index 34e4fa8..7575fb1 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -459,6 +459,7 @@ handle_unlink (char *own_buf)
  static void
  handle_readlink (char *own_buf, int *new_packet_len)
  {
+#if defined (HAVE_READLINK) && defined (PATH_MAX)
    char filename[PATH_MAX], linkname[PATH_MAX];
    char *p;
    int ret, bytes_sent;
@@ -485,6 +486,10 @@ handle_readlink (char *own_buf, int *new_packet_len)
       to return a partial response, but simply fail.  */
    if (bytes_sent < ret)
      sprintf (own_buf, "F-1,%x", FILEIO_ENAMETOOLONG);
+#else
+   hostio_error (own_buf);
+   return;
+#endif
  }
  
  /* Handle all the 'F' file transfer packets.  */



The other question is:

Here it use : PATH_MAX, but some other place, it use MAXPATHLEN
see: inf-child.c

/* Read value of symbolic link FILENAME on the target.  Return a
    null-terminated string allocated via xmalloc, or NULL if an error
    occurs (and set *TARGET_ERRNO).  */
static char *
inf_child_fileio_readlink (const char *filename, int *target_errno)
{
   /* We support readlink only on systems that also provide a compile-time
      maximum path length (MAXPATHLEN), at least for now.  */
#if defined (HAVE_READLINK) && defined (MAXPATHLEN)
   char buf[MAXPATHLEN];
   int len;
   char *ret;

   len = readlink (filename, buf, sizeof buf);
   if (len < 0)
     {
       *target_errno = inf_child_errno_to_fileio_error (errno);
       return NULL;
     }

   ret = xmalloc (len + 1);
   memcpy (ret, buf, len);
   ret[len] = '\0';
   return ret;
#else
   *target_errno = FILEIO_ENOSYS;
   return NULL;
#endif
}


asmwarrior
ollydbg from codeblocks' forum


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-02-09 17:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27  3:20 fix build error on MinGW (HAVE_READLINK) undefined asmwarrior
2012-01-27  9:41 ` Eli Zaretskii
2012-01-27 10:28   ` Pedro Alves
2012-01-27 12:22     ` Eli Zaretskii
2012-01-27 12:36       ` Pedro Alves
2012-01-27 12:47         ` Eli Zaretskii
2012-02-03 11:47     ` [RFA/gdbserver] Provide dummy readlink on systems where routine is not available Joel Brobecker
2012-02-03 11:56       ` Joel Brobecker
2012-02-03 12:31         ` Joel Brobecker
2012-02-03 13:11           ` Eli Zaretskii
2012-02-03 13:26             ` Joel Brobecker
2012-02-09 16:32     ` [RFA/commit] gdbserver: return ENOSYS if readlink not supported Joel Brobecker
2012-02-09 16:41       ` Pedro Alves
2012-02-09 17:32         ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox