* [PATCH] correct readlinkat attribute access (BZ #27024)
@ 2021-01-08 0:49 Martin Sebor
2021-01-08 4:31 ` Siddhesh Poyarekar
2021-01-10 20:52 ` Martin Sebor
0 siblings, 2 replies; 5+ messages in thread
From: Martin Sebor @ 2021-01-08 0:49 UTC (permalink / raw)
To: GNU C Library
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
/* Remove the link NAME. */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct readlinkat attribute access (BZ #27024)
2021-01-08 0:49 [PATCH] correct readlinkat attribute access (BZ #27024) Martin Sebor
@ 2021-01-08 4:31 ` Siddhesh Poyarekar
2021-01-08 9:06 ` Samuel Thibault
2021-01-10 20:52 ` Martin Sebor
1 sibling, 1 reply; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-01-08 4:31 UTC (permalink / raw)
To: Martin Sebor, GNU C Library
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct readlinkat attribute access (BZ #27024)
2021-01-08 4:31 ` Siddhesh Poyarekar
@ 2021-01-08 9:06 ` Samuel Thibault
2021-01-08 9:08 ` Siddhesh Poyarekar
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2021-01-08 9:06 UTC (permalink / raw)
To: Siddhesh Poyarekar; +Cc: Martin Sebor, GNU C Library
Siddhesh Poyarekar, le ven. 08 janv. 2021 10:01:22 +0530, a ecrit:
> On 1/8/21 6:19 AM, Martin Sebor via Libc-alpha wrote:
> > @@ -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?
? This is not on __len, this is on __buf (arg 3) for __len bytes (arg 4)
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct readlinkat attribute access (BZ #27024)
2021-01-08 9:06 ` Samuel Thibault
@ 2021-01-08 9:08 ` Siddhesh Poyarekar
0 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-01-08 9:08 UTC (permalink / raw)
To: Samuel Thibault; +Cc: Martin Sebor, GNU C Library
On 1/8/21 2:36 PM, Samuel Thibault wrote:
>> Why do we need an access attribute at all for __len, let alone a
>> __write_only__ one?
>
> ? This is not on __len, this is on __buf (arg 3) for __len bytes (arg 4)
>
Ugh, sorry I misread that.
Siddhesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct readlinkat attribute access (BZ #27024)
2021-01-08 0:49 [PATCH] correct readlinkat attribute access (BZ #27024) Martin Sebor
2021-01-08 4:31 ` Siddhesh Poyarekar
@ 2021-01-10 20:52 ` Martin Sebor
1 sibling, 0 replies; 5+ messages in thread
From: Martin Sebor @ 2021-01-10 20:52 UTC (permalink / raw)
To: GNU C Library
I committed & pushed this in g:2cd361b511.
Martin
On 1/7/21 5:49 PM, Martin Sebor 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
>
> /* Remove the link NAME. */
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-10 20:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 0:49 [PATCH] correct readlinkat attribute access (BZ #27024) Martin Sebor
2021-01-08 4:31 ` Siddhesh Poyarekar
2021-01-08 9:06 ` Samuel Thibault
2021-01-08 9:08 ` Siddhesh Poyarekar
2021-01-10 20:52 ` Martin Sebor
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).