diff mbox series

[15/21] debug/readlink{, at}_chk.c: Harmonize declaration and definition

Message ID 20230620181910.1506893-16-fberat@redhat.com
State New
Headers show
Series Allow glibc to be built with _FORTIFY_SOURCE | expand

Commit Message

Frederic Berat June 20, 2023, 6:19 p.m. UTC
The declaration and definition of these routines aren't consistent.

Make the definition of __readlink_chk and __readlinkat_chk match the
declaration of the routines they fortify.  While there are no problems
today this avoids any future potential problems related to the mismatch.
---
 debug/readlink_chk.c   | 3 ++-
 debug/readlinkat_chk.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Siddhesh Poyarekar June 22, 2023, 4:11 a.m. UTC | #1
On 2023-06-20 14:19, Frédéric Bérat wrote:
> The declaration and definition of these routines aren't consistent.
> 
> Make the definition of __readlink_chk and __readlinkat_chk match the
> declaration of the routines they fortify.  While there are no problems
> today this avoids any future potential problems related to the mismatch.
> ---

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

>   debug/readlink_chk.c   | 3 ++-
>   debug/readlinkat_chk.c | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/debug/readlink_chk.c b/debug/readlink_chk.c
> index c491db2225..99dea40c7b 100644
> --- a/debug/readlink_chk.c
> +++ b/debug/readlink_chk.c
> @@ -24,7 +24,8 @@
>   
>   
>   ssize_t
> -__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
> +__readlink_chk (const char *__restrict path, char *__restrict buf, size_t len,
> +		size_t buflen)
>   {
>     if (len > buflen)
>       __chk_fail ();
> diff --git a/debug/readlinkat_chk.c b/debug/readlinkat_chk.c
> index 03feac92ec..163dec8b80 100644
> --- a/debug/readlinkat_chk.c
> +++ b/debug/readlinkat_chk.c
> @@ -20,7 +20,8 @@
>   
>   
>   ssize_t
> -__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
> +__readlinkat_chk (int fd, const char *__restrict path,
> +		  char *__restrict buf, size_t len,
>   		  size_t buflen)
>   {
>     if (len > buflen)
diff mbox series

Patch

diff --git a/debug/readlink_chk.c b/debug/readlink_chk.c
index c491db2225..99dea40c7b 100644
--- a/debug/readlink_chk.c
+++ b/debug/readlink_chk.c
@@ -24,7 +24,8 @@ 
 
 
 ssize_t
-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
+__readlink_chk (const char *__restrict path, char *__restrict buf, size_t len,
+		size_t buflen)
 {
   if (len > buflen)
     __chk_fail ();
diff --git a/debug/readlinkat_chk.c b/debug/readlinkat_chk.c
index 03feac92ec..163dec8b80 100644
--- a/debug/readlinkat_chk.c
+++ b/debug/readlinkat_chk.c
@@ -20,7 +20,8 @@ 
 
 
 ssize_t
-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
+__readlinkat_chk (int fd, const char *__restrict path,
+		  char *__restrict buf, size_t len,
 		  size_t buflen)
 {
   if (len > buflen)