From 07c63490d282d369772130e74d241a82ab0bb953 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 22 Apr 2009 16:35:43 +0200 Subject: [PATCH] dbus/dbus-sysdeps-util-win.c: use GetFileAttributes instead of CreateFile in _dbus_file_exists (cherry picked from commit 3ba582b91361785c3eb0121e8b9e85d046eea75f) --- dbus/dbus-sysdeps-util-win.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 620862f..51fcb39 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; } /** -- 2.7.4