[02/26] Linux: renameat2 syscall number is always available

Message ID 191fbd3aeb6a1117649595f0ffd709f533f29efb.1581279333.git.fweimer@redhat.com
State Committed
Delegated to: Carlos O'Donell
Headers

Commit Message

Florian Weimer Feb. 9, 2020, 8:19 p.m. UTC
  Due to the built-in tables, __NR_renameat2 is always defined.
---
 sysdeps/unix/sysv/linux/renameat2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Comments

Adhemerval Zanella Netto Feb. 27, 2020, 11:05 p.m. UTC | #1
On 09/02/2020 17:19, Florian Weimer wrote:
> Due to the built-in tables, __NR_renameat2 is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/renameat2.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/renameat2.c b/sysdeps/unix/sysv/linux/renameat2.c
> index 05304c6445..22b4178a08 100644
> --- a/sysdeps/unix/sysv/linux/renameat2.c
> +++ b/sysdeps/unix/sysv/linux/renameat2.c
> @@ -29,15 +29,14 @@ __renameat2 (int oldfd, const char *old, int newfd, const char *new,
>  #else
>    if (flags == 0)
>      return __renameat (oldfd, old, newfd, new);
> -# ifdef __NR_renameat2
> +
>    /* For non-zero flags, try the renameat2 system call.  */
>    int ret = INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, flags);
>    if (ret != -1 || errno != ENOSYS)
>      /* Preserve non-error/non-ENOSYS return values.  */
>      return ret;
> -# endif
> -  /* No kernel (header) support for renameat2.  All flags are
> -     unknown.  */
> +
> +  /* No kernel support for renameat2.  All flags are unknown.  */
>    __set_errno (EINVAL);
>    return -1;
>  #endif
>
  

Patch

diff --git a/sysdeps/unix/sysv/linux/renameat2.c b/sysdeps/unix/sysv/linux/renameat2.c
index 05304c6445..22b4178a08 100644
--- a/sysdeps/unix/sysv/linux/renameat2.c
+++ b/sysdeps/unix/sysv/linux/renameat2.c
@@ -29,15 +29,14 @@  __renameat2 (int oldfd, const char *old, int newfd, const char *new,
 #else
   if (flags == 0)
     return __renameat (oldfd, old, newfd, new);
-# ifdef __NR_renameat2
+
   /* For non-zero flags, try the renameat2 system call.  */
   int ret = INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, flags);
   if (ret != -1 || errno != ENOSYS)
     /* Preserve non-error/non-ENOSYS return values.  */
     return ret;
-# endif
-  /* No kernel (header) support for renameat2.  All flags are
-     unknown.  */
+
+  /* No kernel support for renameat2.  All flags are unknown.  */
   __set_errno (EINVAL);
   return -1;
 #endif