From bf921462e7397c150e1e45d739f0728989eaef82 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 20 Apr 2000 13:52:41 +0000 Subject: [PATCH] * syscalls.cc (_link): Check new link path for trailing dot. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/syscalls.cc | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 777724f08..1f0b29d00 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +Thu Apr 20 11:26:00 2000 Corinna Vinschen + + * syscalls.cc (_link): Check new link path for trailing dot. + Thu Apr 20 00:32:03 2000 Christopher Faylor * fhandler.h (fhandler_base::hclose): New virtual method. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 23faca911..45978bc91 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -484,21 +484,23 @@ _link (const char *a, const char *b) { int res = -1; path_conv real_a (a, SYMLINK_NOFOLLOW); + path_conv real_b (b, SYMLINK_NOFOLLOW); if (real_a.error) { set_errno (real_a.error); - syscall_printf ("-1 = link (%s, %s)", a, b); - return -1; + goto done; } - - path_conv real_b (b, SYMLINK_NOFOLLOW); - if (real_b.error) { set_errno (real_b.error); - syscall_printf ("-1 = link (%s, %s)", a, b); - return -1; + goto done; + } + 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 */