Change "lock-file" to "lock file" in translatable strings
[platform/upstream/glib.git] / gio / gdbusauthmechanismsha1.c
index 020aaba..4d9438f 100644 (file)
@@ -29,6 +29,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef _WIN32
+#include <io.h>
+#endif
 
 #include <glib/gstdio.h>
 
@@ -37,9 +40,9 @@
 #include "gdbuserror.h"
 #include "gioenumtypes.h"
 #include "gioerror.h"
+#include "gdbusprivate.h"
 
 #include "glibintl.h"
-#include "gioalias.h"
 
 struct _GDBusAuthMechanismSha1Private
 {
@@ -280,7 +283,9 @@ ensure_keyring_directory (GError **error)
               goto out;
             }
 #else
-#error Please implement permission checking on non-UNIX platforms
+#ifdef __GNUC__
+#warning Please implement permission checking on this non-UNIX platform
+#endif
 #endif
         }
         goto out;
@@ -354,8 +359,8 @@ keyring_lookup_entry (const gchar  *cookie_context,
   guint n;
   gchar **lines;
 
-  g_return_val_if_fail (cookie_context != NULL, FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+  g_return_val_if_fail (cookie_context != NULL, NULL);
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
   ret = NULL;
   path = NULL;
@@ -519,7 +524,7 @@ keyring_acquire_lock (const gchar  *path,
       num_tries++;
       if (num_tries == 50)
         {
-          /* ok, we slept 50*10ms = 0.5 seconds.. Conclude that the lock-file must be
+          /* ok, we slept 50*10ms = 0.5 seconds. Conclude that the lock file must be
            * stale (nuke the it from orbit)
            */
           if (g_unlink (lock) != 0)
@@ -527,12 +532,12 @@ keyring_acquire_lock (const gchar  *path,
               g_set_error (error,
                            G_IO_ERROR,
                            g_io_error_from_errno (errno),
-                           _("Error deleting stale lock-file `%s': %s"),
+                           _("Error deleting stale lock file `%s': %s"),
                            lock,
                            strerror (errno));
               goto out;
             }
-          _log ("Deleted stale lock-file `%s'", lock);
+          _log ("Deleted stale lock file `%s'", lock);
           break;
         }
     }
@@ -558,7 +563,7 @@ keyring_acquire_lock (const gchar  *path,
       g_set_error (error,
                    G_IO_ERROR,
                    g_io_error_from_errno (errno),
-                   _("Error creating lock-file `%s': %s"),
+                   _("Error creating lock file `%s': %s"),
                    lock,
                    strerror (errno));
       goto out;
@@ -583,22 +588,22 @@ keyring_release_lock (const gchar  *path,
 
   ret = FALSE;
   lock = g_strdup_printf ("%s.lock", path);
-  if (g_unlink (lock) != 0)
+  if (close (lock_fd) != 0)
     {
       g_set_error (error,
                    G_IO_ERROR,
                    g_io_error_from_errno (errno),
-                   _("Error unlinking lock-file `%s': %s"),
+                   _("Error closing (unlinked) lock file `%s': %s"),
                    lock,
                    strerror (errno));
       goto out;
     }
-  if (close (lock_fd) != 0)
+  if (g_unlink (lock) != 0)
     {
       g_set_error (error,
                    G_IO_ERROR,
                    g_io_error_from_errno (errno),
-                   _("Error closing (unlinked) lock-file `%s': %s"),
+                   _("Error unlinking lock file `%s': %s"),
                    lock,
                    strerror (errno));
       goto out;
@@ -953,11 +958,11 @@ mechanism_server_initiate (GDBusAuthMechanism   *mechanism,
             }
         }
 #elif defined(G_OS_WIN32)
-      GCredentials *credentials;
-      credentials = g_credentials_new_for_process ();
-      if (g_strcmp0 (g_credentials_get_windows_user (credentials), initial_response) == 0)
+      gchar *sid;
+      sid = _g_dbus_win32_get_user_sid ();
+      if (g_strcmp0 (initial_response, sid) == 0)
         m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_HAVE_DATA_TO_SEND;
-      g_object_unref (credentials);
+      g_free (sid);
 #else
 #error Please implement for your OS
 #endif
@@ -1109,13 +1114,9 @@ mechanism_client_initiate (GDBusAuthMechanism   *mechanism,
 #ifdef G_OS_UNIX
   initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) getuid ());
 #elif defined (G_OS_WIN32)
-  {
-    GCredentials *credentials;
-    credentials = g_credentials_new_for_process ();
-    initial_response = g_strdup (g_credentials_get_windows_user (credentials));
-    g_object_unref (credentials);
-  }
+initial_response = _g_dbus_win32_get_user_sid ();
 #else
+#error Please implement for your OS
 #endif
   g_assert (initial_response != NULL);
 
@@ -1215,6 +1216,3 @@ mechanism_client_shutdown (GDBusAuthMechanism   *mechanism)
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
-
-#define __G_DBUS_AUTH_MECHANISM_SHA1_C__
-#include "gioaliasdef.c"