This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH] Cygwin: fix one more check for positive virtual_ftype_t values
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Mon, 22 Jul 2019 18:08:42 +0000
- Subject: [PATCH] Cygwin: fix one more check for positive virtual_ftype_t values
- Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=cornell.edu;dmarc=pass action=none header.from=cornell.edu;dkim=pass header.d=cornell.edu;arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lRIZ2F6KIg+8s/I7+GP+Ipru8KLxUCRk63LN8bVYlXI=; b=Is0SMSyyW+WrgesOUo+c/U6NiOT/tqtDRUhx3IRTOinxBNUGRh9f5KG8V69fRYK5HSNKyK0DXvySYK/TRXiMHrNBZ1GgVAIxRV37Q+hH9lkfzB/cJpfx17oFNIE1Eu8j8DmJ16AYblffYW1OueTEN+UjPDKz7jx489eEQbAh9XlE2ZxXsbHaRkHkOKIg8gTkUSLHRbYOcx32VHV4UhOnsYzfZlfVYeAACMyIprjxIhhhRQQR1uZcgIUkH2bCC/P/WHY3OhRY0RZIBTLim38Jx5slH8/XjrXgKQumoiMpJtMsOTFs9iiaVCa2jOXj7n3a6HRVWwX2ApNZYoClytL/dw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jljz68ze2fG9p9mdu4dUtO9kHgjlFQjjQcAfnmbe3LRMIIe+956XJfNuaIbha+BtKzbwTPbQK7OiJELtxRnczjN+1Cn1DiTFqkSbJpx07J2Rat5XV/XBP4zazt7XM5NHcQBOabaTYyD/DGOKAwdPdA3wVlCPGXbkk9nnYoRkSimstdTAHJn/tBZyna0WOcgLbYtICJnEy5oDoJRhI+LWRYumALdpg6Qrm4D3X5A+piscJLo0B7YWrmj2fGfAYu1j0FANrYK2G4uz3Bp+31c9aEMbfVbEWySGUPZb9HGizL9aRo8iftzLUItYfkn/WNz5ucTL0hh5Axw7pgAxsdkHxQ==
Also drop more comments referring to numerical virtual_ftype_t values.
---
winsup/cygwin/fhandler_process.cc | 3 ---
winsup/cygwin/fhandler_registry.cc | 4 +---
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 0dafc2f0f..2a0655475 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -86,9 +86,6 @@ static bool get_mem_values (DWORD dwProcessId, size_t &vmsize, size_t &vmrss,
size_t &vmtext, size_t &vmdata, size_t &vmlib,
size_t &vmshare);
-/* Returns 0 if path doesn't exist, >0 if path is a directory,
- -1 if path is a file, -2 if path is a symlink, -3 if path is a pipe,
- -4 if path is a socket. */
virtual_ftype_t
fhandler_process::exists ()
{
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
index f7db01b99..5fc03fedd 100644
--- a/winsup/cygwin/fhandler_registry.cc
+++ b/winsup/cygwin/fhandler_registry.cc
@@ -306,8 +306,6 @@ multi_wcstombs (char *dst, size_t len, const wchar_t *src, size_t nwc)
return sum;
}
-/* Returns 0 if path doesn't exist, otherwise a virtual_ftype_t value
- specifying the exact file type. */
virtual_ftype_t
fhandler_registry::exists ()
{
@@ -562,7 +560,7 @@ fhandler_registry::fstat (struct stat *buf)
buf->st_uid = uid;
buf->st_gid = gid;
buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
- if (file_type > virt_none)
+ if (virt_ftype_isdir (file_type))
buf->st_mode |= S_IFDIR;
else
buf->st_mode &= NO_X;
--
2.21.0