Cygwin: linkat: support Linux-specific AT_EMPTY_PATH flag
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
b93022a82d
commit
9443efe099
|
@ -166,6 +166,7 @@ extern "C" {
|
||||||
#define AT_SYMLINK_NOFOLLOW 2
|
#define AT_SYMLINK_NOFOLLOW 2
|
||||||
#define AT_SYMLINK_FOLLOW 4
|
#define AT_SYMLINK_FOLLOW 4
|
||||||
#define AT_REMOVEDIR 8
|
#define AT_REMOVEDIR 8
|
||||||
|
#define AT_EMPTY_PATH 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE
|
||||||
|
|
|
@ -22,6 +22,8 @@ What's new:
|
||||||
|
|
||||||
- Support Linux-specific open(2) flag O_PATH.
|
- Support Linux-specific open(2) flag O_PATH.
|
||||||
|
|
||||||
|
- Support Linux-specific linkat(2) flag AT_EMPTY_PATH.
|
||||||
|
|
||||||
|
|
||||||
What changed:
|
What changed:
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -4812,13 +4812,29 @@ linkat (int olddirfd, const char *oldpathname,
|
||||||
tmp_pathbuf tp;
|
tmp_pathbuf tp;
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
if (flags & ~AT_SYMLINK_FOLLOW)
|
if (flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH))
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
__leave;
|
__leave;
|
||||||
}
|
}
|
||||||
char *oldpath = tp.c_get ();
|
char *oldpath = tp.c_get ();
|
||||||
if (gen_full_path_at (oldpath, olddirfd, oldpathname))
|
/* AT_EMPTY_PATH with an empty oldpathname is equivalent to
|
||||||
|
|
||||||
|
linkat(AT_FDCWD, "/proc/self/fd/<olddirfd>", newdirfd,
|
||||||
|
newname, AT_SYMLINK_FOLLOW);
|
||||||
|
|
||||||
|
Convert the request accordingly. */
|
||||||
|
if ((flags & AT_EMPTY_PATH) && oldpathname && oldpathname[0] == '\0')
|
||||||
|
{
|
||||||
|
if (olddirfd == AT_FDCWD)
|
||||||
|
{
|
||||||
|
set_errno (EPERM);
|
||||||
|
__leave;
|
||||||
|
}
|
||||||
|
__small_sprintf (oldpath, "/proc/%d/fd/%d", myself->pid, olddirfd);
|
||||||
|
flags = AT_SYMLINK_FOLLOW;
|
||||||
|
}
|
||||||
|
else if (gen_full_path_at (oldpath, olddirfd, oldpathname))
|
||||||
__leave;
|
__leave;
|
||||||
char *newpath = tp.c_get ();
|
char *newpath = tp.c_get ();
|
||||||
if (gen_full_path_at (newpath, newdirfd, newpathname))
|
if (gen_full_path_at (newpath, newdirfd, newpathname))
|
||||||
|
|
|
@ -41,6 +41,10 @@ Support for exFAT.
|
||||||
Support Linux-specific open(2) flag O_PATH.
|
Support Linux-specific open(2) flag O_PATH.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para>
|
||||||
|
- Support Linux-specific linkat(2) flag AT_EMPTY_PATH.
|
||||||
|
</para></listitem>
|
||||||
|
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
clock_nanosleep, pthread_condattr_setclock and timer_create now support
|
clock_nanosleep, pthread_condattr_setclock and timer_create now support
|
||||||
all clocks, except CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID.
|
all clocks, except CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID.
|
||||||
|
|
Loading…
Reference in New Issue