* syscalls.cc (_link): Check new link path for trailing dot.

This commit is contained in:
Corinna Vinschen 2000-04-20 13:52:41 +00:00
parent d7aac2acf5
commit bf921462e7
2 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,7 @@
Thu Apr 20 11:26:00 2000 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (_link): Check new link path for trailing dot.
Thu Apr 20 00:32:03 2000 Christopher Faylor <cgf@cygnus.com> Thu Apr 20 00:32:03 2000 Christopher Faylor <cgf@cygnus.com>
* fhandler.h (fhandler_base::hclose): New virtual method. * fhandler.h (fhandler_base::hclose): New virtual method.

View File

@ -484,21 +484,23 @@ _link (const char *a, const char *b)
{ {
int res = -1; int res = -1;
path_conv real_a (a, SYMLINK_NOFOLLOW); path_conv real_a (a, SYMLINK_NOFOLLOW);
path_conv real_b (b, SYMLINK_NOFOLLOW);
if (real_a.error) if (real_a.error)
{ {
set_errno (real_a.error); set_errno (real_a.error);
syscall_printf ("-1 = link (%s, %s)", a, b); goto done;
return -1;
} }
path_conv real_b (b, SYMLINK_NOFOLLOW);
if (real_b.error) if (real_b.error)
{ {
set_errno (real_b.error); set_errno (real_b.error);
syscall_printf ("-1 = link (%s, %s)", a, b); goto done;
return -1; }
if (real_b.get_win32 ()[strlen (real_b.get_win32 ()) - 1] == '.')
{
syscall_printf ("trailing dot, bailing out");
set_errno (EINVAL);
goto done;
} }
/* Try to make hard link first on Windows NT */ /* Try to make hard link first on Windows NT */