* fhandler_fifo.cc (fhandler_fifo::open): Use MAX_NAME for pipe name

buffer size.
	(fhandler_fifo::fstatvfs): Use same technique as in fhandler_socket.
	* fhandler_proc.cc (format_proc_partitions): Use NAME_MAX+1 for
	device name buffer size.  Use MAX_PATH for device path buffer size.
This commit is contained in:
Corinna Vinschen 2007-12-04 13:29:44 +00:00
parent 41d46fe86f
commit 86a1bb43f5
2 changed files with 7 additions and 14 deletions

View File

@ -65,7 +65,7 @@ int
fhandler_fifo::open (int flags, mode_t)
{
int res;
char npname[CYG_MAX_PATH];
char npname[MAX_PATH];
DWORD mode = 0;
/* Generate a semi-unique name to associate with this fifo.
@ -164,14 +164,7 @@ fhandler_fifo::write (const void *ptr, size_t len)
int __stdcall
fhandler_fifo::fstatvfs (struct statvfs *sfs)
{
/* Call statvfs on parent dir. */
char *c, dir[CYG_MAX_PATH];
strcpy (dir, get_name ());
if ((c = strrchr (dir, '/')))
{
*c = '\0';
return statvfs (dir, sfs);
}
set_errno (EBADF);
return -1;
fhandler_disk_file fh (pc);
fh.get_device () = FH_FS;
return fh.fstatvfs (sfs);
}

View File

@ -1030,14 +1030,14 @@ format_proc_partitions (char *destbuf, size_t maxsize)
char *bufptr = destbuf;
print ("major minor #blocks name\n\n");
char devname[CYG_MAX_PATH];
char devname[NAME_MAX + 1];
OBJECT_ATTRIBUTES attr;
HANDLE dirhdl, devhdl;
IO_STATUS_BLOCK io;
NTSTATUS status;
/* Open \Device object directory. */
wchar_t wpath[CYG_MAX_PATH] = L"\\Device";
wchar_t wpath[MAX_PATH] = L"\\Device";
UNICODE_STRING upath = {14, 16, wpath};
InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL);
status = NtOpenDirectoryObject (&dirhdl, DIRECTORY_QUERY, &attr);
@ -1056,7 +1056,7 @@ format_proc_partitions (char *destbuf, size_t maxsize)
&context, NULL)))
{
restart = FALSE;
sys_wcstombs (devname, CYG_MAX_PATH - 1, dbi->ObjectName.Buffer,
sys_wcstombs (devname, NAME_MAX + 1, dbi->ObjectName.Buffer,
dbi->ObjectName.Length / 2);
/* ... and check for a "Harddisk[0-9]*" entry. */
if (!strncasematch (devname, "Harddisk", 8)