summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/mount.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-02-06 20:38:35 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-02-06 20:38:35 +0000
commitabbe1f5320881ec7da114a4e0b6d17045d6b5500 (patch)
tree19a806f7d195cc35873a287f58ed285f2492ed20 /winsup/cygwin/mount.cc
parent46913a8290408f9321791c0ee00b786c4f767b75 (diff)
downloadcygnal-abbe1f5320881ec7da114a4e0b6d17045d6b5500.tar.gz
cygnal-abbe1f5320881ec7da114a4e0b6d17045d6b5500.tar.bz2
cygnal-abbe1f5320881ec7da114a4e0b6d17045d6b5500.zip
* 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.
Diffstat (limited to 'winsup/cygwin/mount.cc')
-rw-r--r--winsup/cygwin/mount.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 02fd8e8b9..4abc77e68 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -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';