diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3bf9f45d5..5000d636a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2009-10-12 Corinna Vinschen + + * fhandler_disk_file.cc (fhandler_disk_file::link): Only append .lnk + if the original device had one, too. Add comment. + + * fhandler_socket.cc (fhandler_socket::fstat): Always return a size of + 0 on sockets. + 2009-10-09 Corinna Vinschen * path.cc (tfx_chars): Convert all ASCII control characters except diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 1e6a781e0..eaf065f1e 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1210,7 +1210,12 @@ fhandler_disk_file::link (const char *newpath) char new_buf[nlen + 5]; if (!newpc.error) { - if (pc.is_lnk_special ()) + /* If the original file is a lnk special file (except for sockets), + and if the original file has a .lnk suffix, add one to the hardlink + as well. */ + if (pc.is_lnk_special () && !pc.issocket () + && RtlEqualUnicodePathSuffix (pc.get_nt_native_path (), + &ro_u_lnk, TRUE)) { /* Shortcut hack. */ stpcpy (stpcpy (new_buf, newpath), ".lnk"); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 30253f9e5..5f1ab2776 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -698,6 +698,7 @@ fhandler_socket::fstat (struct __stat64 *buf) if (!res) { buf->st_mode = (buf->st_mode & ~S_IFMT) | S_IFSOCK; + buf->st_size = 0; } } else @@ -708,6 +709,7 @@ fhandler_socket::fstat (struct __stat64 *buf) buf->st_dev = 0; buf->st_ino = (__ino64_t) ((DWORD) get_handle ()); buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO; + buf->st_size = 0; } } return res;