From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30347 invoked by alias); 3 Feb 2012 13:11:40 -0000 Received: (qmail 30145 invoked by uid 22791); 3 Feb 2012 13:11:39 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Feb 2012 13:11:23 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LYT00I00J71MC00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Fri, 03 Feb 2012 15:11:21 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.37.111]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LYT00H96JAWMNC0@a-mtaout22.012.net.il>; Fri, 03 Feb 2012 15:11:21 +0200 (IST) Date: Fri, 03 Feb 2012 13:11:00 -0000 From: Eli Zaretskii Subject: Re: [RFA/gdbserver] Provide dummy readlink on systems where routine is not available. In-reply-to: <20120203123030.GJ31383@adacore.com> To: Joel Brobecker Cc: gdb-patches@sourceware.org, palves@redhat.com Reply-to: Eli Zaretskii Message-id: <83r4ycdptz.fsf@gnu.org> References: <1328269562-19101-1-git-send-email-brobecker@adacore.com> <1328270124-27388-1-git-send-email-brobecker@adacore.com> <20120203123030.GJ31383@adacore.com> X-IsSubscribed: yes 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-02/txt/msg00050.txt.bz2 > Date: Fri, 3 Feb 2012 16:30:30 +0400 > From: Joel Brobecker > Cc: palves@redhat.com > > Another revised version, with 2 small changes: > - The pre-processor condition used to determine whether we need to > declare readlink in gdb_readlink.h or not was wrong. Somehow, > HAVE_ macros and HAVE_DECL_ macros are handled differently. > - I forgot to update hostio.c's dependency on gdb_readlink.h > in the Makefile. > > Both issues now fixed, and new patch attached. If memory serves, Pedro was against this when I suggested it. > + This function return -1 (error) and sets errno to ENOSYS to indicate > + that this function is not implemented. The caller should be prepared > + to recover from that. */ But the function in fact returns EINVAL: > +ssize_t > +readlink(const char *path, char *buf, size_t bufsiz) > +{ > + errno = EINVAL; > + return -1; > +} I cannot resist re-iterating my original suggestion: test the file for existence, return ENOENT if it doesn't exist, and otherwise return EINVAL, meaning that the file is not a link. Or just use the readlink module from gnulib, which does exactly that.