public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Martin Sebor <msebor@gmail.com>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] correct readlinkat attribute access (BZ #27024)
Date: Fri, 8 Jan 2021 10:01:22 +0530	[thread overview]
Message-ID: <42f6934f-da58-0d1c-d953-4504ba240a42@gotplt.org> (raw)
In-Reply-To: <b39497cd-12ae-981c-73d4-22e99d57ba77@gmail.com>

On 1/8/21 6:19 AM, Martin Sebor via Libc-alpha wrote:
> The mode in the new attribute access added in g:06febd8c670
> to readlinkat() for the third argument is wrong: it's read_only
> but the function writes into the object.  The mode should be
> write_only.
> 
> The trivial patch below corrects this mistake.  Unless there
> are objections I'll go ahead and commit it in the next few days.
> 
> Martin
> 
> diff --git a/posix/unistd.h b/posix/unistd.h
> index 1306aded46..3f22763379 100644
> --- a/posix/unistd.h
> +++ b/posix/unistd.h
> @@ -831,7 +831,7 @@ extern int symlinkat (const char *__from, int __tofd,
>   /* Like readlink but a relative PATH is interpreted relative to FD.  */
>   extern ssize_t readlinkat (int __fd, const char *__restrict __path,
>                             char *__restrict __buf, size_t __len)
> -     __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, 
> 4));
> +     __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 
> 3, 4));
>   #endif

Why do we need an access attribute at all for __len, let alone a 
__write_only__ one?

Siddhesh

  reply	other threads:[~2021-01-08  4:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08  0:49 Martin Sebor
2021-01-08  4:31 ` Siddhesh Poyarekar [this message]
2021-01-08  9:06   ` Samuel Thibault
2021-01-08  9:08     ` Siddhesh Poyarekar
2021-01-10 20:52 ` Martin Sebor

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=42f6934f-da58-0d1c-d953-4504ba240a42@gotplt.org \
    --to=siddhesh@gotplt.org \
    --cc=libc-alpha@sourceware.org \
    --cc=msebor@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).