From 109e4822783c39090bc4c1d3a0ff670ca56839bb Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 26 Jun 2002 04:21:01 +0000 Subject: [PATCH] * winsup.h: Minor cleanup. * path.h (path_conv::[]): New operator. * syscalls.cc (_link): Use path_conv operators rather than methods, where appropriate. Minor white space cleanup. * include/cygwin/version.h: Bump DLL minor number. * dcrt0.cc (sm): Make NO_COPY. --- winsup/cygwin/ChangeLog | 15 +++++++++++++++ winsup/cygwin/dcrt0.cc | 2 +- winsup/cygwin/include/cygwin/version.h | 2 +- winsup/cygwin/path.h | 1 + winsup/cygwin/syscalls.cc | 22 ++++++++++++---------- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 67f6d8ffb..cc3ea2890 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,18 @@ +2002-06-26 Christopher Faylor + + * winsup.h: Minor cleanup. + * path.h (path_conv::[]): New operator. + * syscalls.cc (_link): Use path_conv operators rather than methods, + where appropriate. Minor white space cleanup. + +2002-06-26 Christopher Faylor + + * include/cygwin/version.h: Bump DLL minor number. + +2002-06-25 Christopher Faylor + + * dcrt0.cc (sm): Make NO_COPY. + 2002-06-25 Corinna Vinschen * syscalls.cc (chown): Convert uid to 32 bit. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 4f4f9c393..f5fef08aa 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -452,7 +452,7 @@ check_sanity_and_sync (per_process *p) } child_info NO_COPY *child_proc_info = NULL; -static MEMORY_BASIC_INFORMATION sm; +static MEMORY_BASIC_INFORMATION NO_COPY sm; #define CYGWIN_GUARD ((wincap.has_page_guard ()) ? PAGE_GUARD : PAGE_NOACCESS) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 6ab596e09..4c1437bc2 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -44,7 +44,7 @@ details. */ /* The current cygwin version is 1.3.6 */ #define CYGWIN_VERSION_DLL_MAJOR 1003 -#define CYGWIN_VERSION_DLL_MINOR 11 +#define CYGWIN_VERSION_DLL_MINOR 12 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 50c5a743c..3d9b86c15 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -147,6 +147,7 @@ class path_conv operator const char *() {return path;} operator DWORD &() {return fileattr;} operator int &() {return (int) fileattr; } + char operator [](int i) const {return path[i];} BOOL is_device () {return devn != FH_BAD && devn != FH_DISK;} DWORD get_devn () {return devn == FH_BAD ? (DWORD) FH_DISK : devn;} short get_unitn () {return devn == FH_BAD ? 0 : unit;} diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 54c238e48..65f06d90d 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -615,14 +615,15 @@ _link (const char *a, const char *b) { int res = -1; sigframe thisframe (mainthread); - path_conv real_a (a, PC_SYM_NOFOLLOW | PC_FULL); path_conv real_b (b, PC_SYM_NOFOLLOW | PC_FULL); - + path_conv real_a (a, PC_SYM_NOFOLLOW | PC_FULL); + if (real_a.error) { set_errno (real_a.error); goto done; } + if (real_b.error) { set_errno (real_b.case_clash ? ECASECLASH : real_b.error); @@ -631,11 +632,12 @@ _link (const char *a, const char *b) if (real_b.exists ()) { - syscall_printf ("file '%s' exists?", (char *)real_b); + syscall_printf ("file '%s' exists?", (char *) real_b); set_errno (EEXIST); goto done; } - if (real_b.get_win32 ()[strlen (real_b.get_win32 ()) - 1] == '.') + + if (real_b[strlen (real_b) - 1] == '.') { syscall_printf ("trailing dot, bailing out"); set_errno (EINVAL); @@ -645,7 +647,7 @@ _link (const char *a, const char *b) /* Try to make hard link first on Windows NT */ if (wincap.has_hard_links ()) { - if (CreateHardLinkA (real_b.get_win32 (), real_a.get_win32 (), NULL)) + if (CreateHardLinkA (real_b, real_a, NULL)) { res = 0; goto done; @@ -663,7 +665,7 @@ _link (const char *a, const char *b) BOOL bSuccess; hFileSource = CreateFile ( - real_a.get_win32 (), + real_a, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE /*| FILE_SHARE_DELETE*/, &sec_none_nih, // sa @@ -678,8 +680,7 @@ _link (const char *a, const char *b) goto docopy; } - lpContext = NULL; - cbPathLen = sys_mbstowcs (wbuf, real_b.get_win32 (), MAX_PATH) * sizeof (WCHAR); + cbPathLen = sys_mbstowcs (wbuf, real_b, MAX_PATH) * sizeof (WCHAR); StreamId.dwStreamId = BACKUP_LINK; StreamId.dwStreamAttributes = 0; @@ -688,8 +689,9 @@ _link (const char *a, const char *b) StreamId.Size.LowPart = cbPathLen; StreamSize = sizeof (WIN32_STREAM_ID) - sizeof (WCHAR**) + - StreamId.dwStreamNameSize; + StreamId.dwStreamNameSize; + lpContext = NULL; /* Write the WIN32_STREAM_ID */ bSuccess = BackupWrite ( hFileSource, @@ -741,7 +743,7 @@ _link (const char *a, const char *b) } docopy: /* do this with a copy */ - if (CopyFileA (real_a.get_win32 (), real_b.get_win32 (), 1)) + if (CopyFileA (real_a, real_b, 1)) res = 0; else __seterrno ();