4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-19 07:22:14 +08:00

* path.cc (get_nt_native_path): Allow to convert special paths which

have no native NT path representation for simplified debug output.
	* syscalls.cc: Convert debug output to print native NT path.
	(unlink): Drop redundant debug output.
This commit is contained in:
Corinna Vinschen 2007-08-15 16:27:09 +00:00
parent 6d70255fe8
commit c4bd837700
3 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2007-08-15 Corinna Vinschen <corinna@vinschen.de>
* path.cc (get_nt_native_path): Allow to convert special paths which
have no native NT path representation for simplified debug output.
* syscalls.cc: Convert debug output to print native NT path.
(unlink): Drop redundant debug output.
2007-08-15 Corinna Vinschen <corinna@vinschen.de> 2007-08-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::link): Drop superfluous * fhandler_disk_file.cc (fhandler_disk_file::link): Drop superfluous

View File

@ -544,20 +544,22 @@ path_conv::set_normalized_path (const char *path_copy, bool strip_tail)
PUNICODE_STRING PUNICODE_STRING
get_nt_native_path (const char *path, UNICODE_STRING &upath) get_nt_native_path (const char *path, UNICODE_STRING &upath)
{ {
if (path[0] != '\\') /* X:\... or NUL, etc. */ if (path[0] == '/') /* special path w/o NT path representation. */
str2uni_cat (upath, path);
else if (path[0] != '\\') /* X:\... or NUL, etc. */
{ {
str2uni_cat (upath, "\\??\\"); str2uni_cat (upath, "\\??\\");
str2uni_cat (upath, path); str2uni_cat (upath, path);
} }
else if (path[1] != '\\') /* \Device\... */ else if (path[1] != '\\') /* \Device\... */
str2uni_cat (upath, path); str2uni_cat (upath, path);
else if ((path[2] != '.' && path[2] != '?') else if ((path[2] != '.' && path[2] != '?')
|| path[3] != '\\') /* \\server\share\... */ || path[3] != '\\') /* \\server\share\... */
{ {
str2uni_cat (upath, "\\??\\UNC\\"); str2uni_cat (upath, "\\??\\UNC\\");
str2uni_cat (upath, path + 2); str2uni_cat (upath, path + 2);
} }
else /* \\.\device or \\?\foo */ else /* \\.\device or \\?\foo */
{ {
str2uni_cat (upath, "\\??\\"); str2uni_cat (upath, "\\??\\");
str2uni_cat (upath, path + 4); str2uni_cat (upath, path + 4);

View File

@ -538,8 +538,6 @@ unlink (const char *ourname)
goto done; goto done;
} }
syscall_printf ("_unlink (%s)", win32_name.get_win32 ());
if (!win32_name.exists ()) if (!win32_name.exists ())
{ {
syscall_printf ("unlinking a nonexistent file"); syscall_printf ("unlinking a nonexistent file");
@ -1356,8 +1354,8 @@ stat_worker (path_conv &pc, struct __stat64 *buf)
if (!(fh = build_fh_pc (pc))) if (!(fh = build_fh_pc (pc)))
goto error; goto error;
debug_printf ("(%s, %p, %p), file_attributes %d", debug_printf ("(%S, %p, %p), file_attributes %d",
pc.normalized_path, buf, fh, (DWORD) *fh); pc.get_nt_native_path (), buf, fh, (DWORD) *fh);
memset (buf, 0, sizeof (*buf)); memset (buf, 0, sizeof (*buf));
res = fh->fstat (buf); res = fh->fstat (buf);
if (!res) if (!res)
@ -1376,7 +1374,7 @@ stat_worker (path_conv &pc, struct __stat64 *buf)
error: error:
MALLOC_CHECK; MALLOC_CHECK;
syscall_printf ("%d = (%s, %p)", res, pc.normalized_path ?: "", buf); syscall_printf ("%d = (%S, %p)", res, pc.get_nt_native_path (), buf);
return res; return res;
} }
@ -2057,8 +2055,9 @@ setmode (int fd, int mode)
else else
cfd->set_flags ((cfd->get_flags () & ~(O_TEXT | O_BINARY)) | mode); cfd->set_flags ((cfd->get_flags () & ~(O_TEXT | O_BINARY)) | mode);
syscall_printf ("(%d<%s>, %p) returning %s", fd, cfd->get_name (), syscall_printf ("(%d<%s>, %p) returning %s", fd,
mode, res & O_TEXT ? "text" : "binary"); cfd->pc.get_nt_native_path (), mode,
res & O_TEXT ? "text" : "binary");
return res; return res;
} }