Linux: consolidate symlink implementation

Use symlink syscall if defined, otherwise use symlinkat.

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella Netto 2022-10-19 19:14:16 -03:00 committed by Adhemerval Zanella
parent 54ed77914a
commit bf58f34a70

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
/* Make a new name for a file. Linux version.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -23,6 +24,10 @@
int
__symlink (const char *from, const char *to)
{
return INLINE_SYSCALL (symlinkat, 3, from, AT_FDCWD, to);
#ifdef __NR_symlink
return INLINE_SYSCALL_CALL (symlink, from, to);
#else
return INLINE_SYSCALL_CALL (symlinkat, from, AT_FDCWD, to);
#endif
}
weak_alias (__symlink, symlink)