4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

* fhandler_disk_file.cc (fhandler_disk_file::fchown): Fix typo in

comment.
	* mount.cc (mount_info::from_fstab): Use tmp_pathbuf rather than
	stack for big local buffer.
	* net.cc (cygwin_gethostname): Call GetComputerNameExA rather than
	GetComputerNameA if gethostname failed.
	* shared.cc (user_info::initialize): Fix formatting.
	* include/sys/file.h: Define flock and accompanying macros if not
	already defined in sys/_default_fcntl.h.
This commit is contained in:
Corinna Vinschen 2014-02-06 20:38:35 +00:00
parent 46913a8290
commit abbe1f5320
6 changed files with 36 additions and 11 deletions

View File

@ -1,3 +1,15 @@
2014-02-06 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::fchown): Fix typo in
comment.
* mount.cc (mount_info::from_fstab): Use tmp_pathbuf rather than
stack for big local buffer.
* net.cc (cygwin_gethostname): Call GetComputerNameExA rather than
GetComputerNameA if gethostname failed.
* shared.cc (user_info::initialize): Fix formatting.
* include/sys/file.h: Define flock and accompanying macros if not
already defined in sys/_default_fcntl.h.
2014-02-04 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 29.

View File

@ -1,7 +1,7 @@
/* fhandler_disk_file.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@ -928,7 +928,7 @@ fhandler_disk_file::fchown (uid_t uid, gid_t gid)
if (pc.issymlink ())
attrib = S_IFLNK | STD_RBITS | STD_WBITS;
res = set_file_attribute (get_handle (), pc, uid, gid, attrib);
/* If you're running a Samba server which has no winbidd running, the
/* If you're running a Samba server which has no winbind running, the
uid<->SID mapping is disfunctional. Even trying to chown to your
own account fails since the account used on the server is the UNIX
account which gets used for the standard user mapping. This is a

View File

@ -31,4 +31,16 @@
#define L_INCR SEEK_CUR
#define L_XTND SEEK_END
/* Including <sys/file.h> always defines flock & macros. */
#if __BSD_VISIBLE - 0 == 0
#define LOCK_SH 0x01 /* shared file lock */
#define LOCK_EX 0x02 /* exclusive file lock */
#define LOCK_NB 0x04 /* don't block when locking */
#define LOCK_UN 0x08 /* unlock file */
extern int flock _PARAMS ((int, int));
#endif
#endif

View File

@ -1,7 +1,7 @@
/* mount.cc: mount handling.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@ -1180,6 +1180,7 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
IO_STATUS_BLOCK io;
NTSTATUS status;
HANDLE fh;
tmp_pathbuf tp;
if (user)
{
@ -1204,13 +1205,13 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
return false;
}
char buf[NT_MAX_PATH];
char *buf = tp.c_get ();
char *got = buf;
DWORD len = 0;
unsigned line = 1;
/* Using buffer size - 2 leaves space to append two \0. */
while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, got,
(sizeof (buf) - 2) - (got - buf), NULL, NULL)))
(NT_MAX_PATH - 2) - (got - buf), NULL, NULL)))
{
char *end;
@ -1232,7 +1233,7 @@ retry:
got = end + 1;
++line;
}
if (len < (sizeof (buf) - 2))
if (len < (NT_MAX_PATH - 2))
break;
/* Check if the buffer contained at least one \n. If not, the
line length is > 32K. We don't take such long lines. Print
@ -1241,7 +1242,7 @@ retry:
{
system_printf ("%W: Line %d too long, skipping...", fstab, line);
while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, buf,
(sizeof (buf) - 2), NULL, NULL)))
(NT_MAX_PATH - 2), NULL, NULL)))
{
len = io.Information;
buf[len] = buf[len + 1] = '\0';

View File

@ -1,7 +1,7 @@
/* net.cc: network-related routines.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@ -1007,7 +1007,7 @@ cygwin_gethostname (char *name, size_t len)
{
DWORD local_len = len;
if (!GetComputerNameA (name, &local_len))
if (!GetComputerNameExA (ComputerNameDnsFullyQualified, name, &local_len))
{
set_winsock_errno ();
return -1;

View File

@ -1,7 +1,7 @@
/* shared.cc: shared data area support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@ -230,7 +230,7 @@ user_info::initialize ()
spinlock sversion (version, CURR_USER_MAGIC);
if (!sversion)
{
cb = sizeof (*user_shared);
cb = sizeof (*user_shared);
cygpsid sid (cygheap->user.sid ());
struct passwd *pw = internal_getpwsid (sid);
/* Correct the user name with what's defined in /etc/passwd before