* 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.
This commit is contained in:
Christopher Faylor 2002-06-26 04:21:01 +00:00
parent b4b15309b7
commit 109e482278
5 changed files with 30 additions and 12 deletions

View File

@ -1,3 +1,18 @@
2002-06-26 Christopher Faylor <cgf@redhat.com>
* 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 <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-06-25 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (sm): Make NO_COPY.
2002-06-25 Corinna Vinschen <corinna@vinschen.de> 2002-06-25 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (chown): Convert uid to 32 bit. * syscalls.cc (chown): Convert uid to 32 bit.

View File

@ -452,7 +452,7 @@ check_sanity_and_sync (per_process *p)
} }
child_info NO_COPY *child_proc_info = NULL; 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) #define CYGWIN_GUARD ((wincap.has_page_guard ()) ? PAGE_GUARD : PAGE_NOACCESS)

View File

@ -44,7 +44,7 @@ details. */
/* The current cygwin version is 1.3.6 */ /* The current cygwin version is 1.3.6 */
#define CYGWIN_VERSION_DLL_MAJOR 1003 #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 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are
incompatible. */ incompatible. */

View File

@ -147,6 +147,7 @@ class path_conv
operator const char *() {return path;} operator const char *() {return path;}
operator DWORD &() {return fileattr;} operator DWORD &() {return fileattr;}
operator int &() {return (int) fileattr; } operator int &() {return (int) fileattr; }
char operator [](int i) const {return path[i];}
BOOL is_device () {return devn != FH_BAD && devn != FH_DISK;} BOOL is_device () {return devn != FH_BAD && devn != FH_DISK;}
DWORD get_devn () {return devn == FH_BAD ? (DWORD) FH_DISK : devn;} DWORD get_devn () {return devn == FH_BAD ? (DWORD) FH_DISK : devn;}
short get_unitn () {return devn == FH_BAD ? 0 : unit;} short get_unitn () {return devn == FH_BAD ? 0 : unit;}

View File

@ -615,14 +615,15 @@ _link (const char *a, const char *b)
{ {
int res = -1; int res = -1;
sigframe thisframe (mainthread); 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_b (b, PC_SYM_NOFOLLOW | PC_FULL);
path_conv real_a (a, PC_SYM_NOFOLLOW | PC_FULL);
if (real_a.error) if (real_a.error)
{ {
set_errno (real_a.error); set_errno (real_a.error);
goto done; goto done;
} }
if (real_b.error) if (real_b.error)
{ {
set_errno (real_b.case_clash ? ECASECLASH : 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 ()) if (real_b.exists ())
{ {
syscall_printf ("file '%s' exists?", (char *)real_b); syscall_printf ("file '%s' exists?", (char *) real_b);
set_errno (EEXIST); set_errno (EEXIST);
goto done; 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"); syscall_printf ("trailing dot, bailing out");
set_errno (EINVAL); set_errno (EINVAL);
@ -645,7 +647,7 @@ _link (const char *a, const char *b)
/* Try to make hard link first on Windows NT */ /* Try to make hard link first on Windows NT */
if (wincap.has_hard_links ()) 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; res = 0;
goto done; goto done;
@ -663,7 +665,7 @@ _link (const char *a, const char *b)
BOOL bSuccess; BOOL bSuccess;
hFileSource = CreateFile ( hFileSource = CreateFile (
real_a.get_win32 (), real_a,
FILE_WRITE_ATTRIBUTES, FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE /*| FILE_SHARE_DELETE*/, FILE_SHARE_READ | FILE_SHARE_WRITE /*| FILE_SHARE_DELETE*/,
&sec_none_nih, // sa &sec_none_nih, // sa
@ -678,8 +680,7 @@ _link (const char *a, const char *b)
goto docopy; goto docopy;
} }
lpContext = NULL; cbPathLen = sys_mbstowcs (wbuf, real_b, MAX_PATH) * sizeof (WCHAR);
cbPathLen = sys_mbstowcs (wbuf, real_b.get_win32 (), MAX_PATH) * sizeof (WCHAR);
StreamId.dwStreamId = BACKUP_LINK; StreamId.dwStreamId = BACKUP_LINK;
StreamId.dwStreamAttributes = 0; StreamId.dwStreamAttributes = 0;
@ -688,8 +689,9 @@ _link (const char *a, const char *b)
StreamId.Size.LowPart = cbPathLen; StreamId.Size.LowPart = cbPathLen;
StreamSize = sizeof (WIN32_STREAM_ID) - sizeof (WCHAR**) + StreamSize = sizeof (WIN32_STREAM_ID) - sizeof (WCHAR**) +
StreamId.dwStreamNameSize; StreamId.dwStreamNameSize;
lpContext = NULL;
/* Write the WIN32_STREAM_ID */ /* Write the WIN32_STREAM_ID */
bSuccess = BackupWrite ( bSuccess = BackupWrite (
hFileSource, hFileSource,
@ -741,7 +743,7 @@ _link (const char *a, const char *b)
} }
docopy: docopy:
/* do this with a copy */ /* 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; res = 0;
else else
__seterrno (); __seterrno ();