From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12364 invoked by alias); 16 Jan 2012 15:17:53 -0000 Received: (qmail 12316 invoked by uid 22791); 16 Jan 2012 15:17:50 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jan 2012 15:17:31 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0GFHT1U005982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Jan 2012 10:17:29 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0GFHRIn019021; Mon, 16 Jan 2012 10:17:28 -0500 Message-ID: <4F143F87.5090703@redhat.com> Date: Mon, 16 Jan 2012 15:37:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Ulrich Weigand CC: gdb-patches@sourceware.org Subject: Re: [rfc v2][4/6] Readlink as file I/O target operation References: <201201131815.q0DIFCKZ001538@d06av02.portsmouth.uk.ibm.com> In-Reply-To: <201201131815.q0DIFCKZ001538@d06av02.portsmouth.uk.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00545.txt.bz2 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