summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-util-win.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2009-04-22 16:35:43 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2009-11-30 13:43:16 +0100
commit07c63490d282d369772130e74d241a82ab0bb953 (patch)
tree55b256443c62dfbb31d3246782581aa5f9a74005 /dbus/dbus-sysdeps-util-win.c
parentfb11d1f9f30ce83846246b9aa455f7a1b1fb28d9 (diff)
downloaddbus-07c63490d282d369772130e74d241a82ab0bb953.tar.gz
dbus/dbus-sysdeps-util-win.c: use GetFileAttributes instead of CreateFile in _dbus_file_exists (cherry picked from commit 3ba582b91361785c3eb0121e8b9e85d046eea75f)
Diffstat (limited to 'dbus/dbus-sysdeps-util-win.c')
-rw-r--r--dbus/dbus-sysdeps-util-win.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c
index 620862ff..51fcb393 100644
--- a/dbus/dbus-sysdeps-util-win.c
+++ b/dbus/dbus-sysdeps-util-win.c
@@ -406,24 +406,12 @@ _dbus_set_signal_handler (int sig,
dbus_bool_t
_dbus_file_exists (const char *file)
{
- HANDLE h = CreateFile(
- file, /* LPCTSTR lpFileName*/
- 0, /* DWORD dwDesiredAccess */
- 0, /* DWORD dwShareMode*/
- NULL, /* LPSECURITY_ATTRIBUTES lpSecurityAttributes */
- OPEN_EXISTING, /* DWORD dwCreationDisposition */
- FILE_ATTRIBUTE_NORMAL, /* DWORD dwFlagsAndAttributes */
- NULL /* HANDLE hTemplateFile */
- );
-
- /* file not found, use local copy of session.conf */
- if (h != INVALID_HANDLE_VALUE && GetLastError() != ERROR_PATH_NOT_FOUND)
- {
- CloseHandle(h);
- return TRUE;
- }
- else
- return FALSE;
+ DWORD attributes = GetFileAttributes (file);
+
+ if (attributes != INVALID_FILE_ATTRIBUTES && GetLastError() != ERROR_PATH_NOT_FOUND)
+ return TRUE;
+ else
+ return FALSE;
}
/**