Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc v2][4/6] Readlink as file I/O target operation
Date: Mon, 16 Jan 2012 15:37:00 -0000	[thread overview]
Message-ID: <4F143F87.5090703@redhat.com> (raw)
In-Reply-To: <201201131815.q0DIFCKZ001538@d06av02.portsmouth.uk.ibm.com>

Hi,

On 01/13/2012 06:15 PM, Ulrich Weigand wrote:
> +/* Read value of symbolic link FILENAME on the remote target.  Return
> +   a null-terminated string allocated via xmalloc, or NULL if an error
> +   occurs (and set *REMOTE_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_EUNKNOWN;

Should this be FILEIO_ENOSYS ?

-- 
Pedro Alves


  parent reply	other threads:[~2012-01-16 15:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 18:16 Ulrich Weigand
2012-01-13 18:29 ` Eli Zaretskii
2012-01-16 13:29   ` Ulrich Weigand
2012-01-16 14:48     ` Eli Zaretskii
2012-01-16 15:03       ` Ulrich Weigand
2012-01-16 17:18         ` Eli Zaretskii
2012-01-16 15:37 ` Pedro Alves [this message]
2012-01-16 17:26   ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F143F87.5090703@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox