]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
* dbus/dbus-sysdeps-win.c
authorRalf Habacker <ralf.habacker@freenet.de>
Sat, 7 Jul 2007 11:14:44 +0000 (11:14 +0000)
committerRalf Habacker <ralf.habacker@freenet.de>
Sat, 7 Jul 2007 11:14:44 +0000 (11:14 +0000)
(_dbus_getsid): remove unused jump label
(_dbus_read_credentials_socket): _dbus_string_init could fail, check initialisation
(_dbus_get_working_dir, _dbus_init_working_dir): remove unused functions

ChangeLog
dbus/dbus-sysdeps-win.c

index c19a1af2f334b519bd7a1a0fccdd52cf5d87a242..421af10d95ff02f53f8333d228439ae518fe3678 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-07-07  Ralf Habacker  <ralf.habacker@freenet.de>
+
+       * dbus/dbus-sysdeps-win.c 
+               (_dbus_getsid): remove unused jump label
+               (_dbus_read_credentials_socket): _dbus_string_init could fail, 
+               check initialisation
+               (_dbus_get_working_dir, _dbus_init_working_dir): remove unused 
+                       functions
+
 2007-07-04  Ralf Habacker  <ralf.habacker@freenet.de>
 
        * cmake/modules/FindKDEWIN.cmake: search in <program files dir>\win32libs 
index 7fba2f4539483d9981e0bf15debf703d2306272e..f09ea21366cf016bf944b90bd4cf88d11b665ca1 100644 (file)
@@ -95,44 +95,6 @@ static int  win_encap_randomizer;
 static DBusHashTable *sid_atom_cache = NULL;
 #endif
 
-static DBusString dbusdir;
-static int working_dir_init = 0;
-
-int _dbus_init_working_dir(char *s)
-{
-  /* change working directory to one level above 
-     of dbus-daemon executable path.  
-     This allows the usage of relative path in 
-     config files or command line parameters */
-  DBusString daemon_path,bin_path;
-
-  if (!_dbus_string_init (&daemon_path))
-    return FALSE;
-  
-  if (!_dbus_string_init (&bin_path))
-    return FALSE;
-
-  if (!_dbus_string_init (&dbusdir))
-    return FALSE;
-  
-  _dbus_string_append(&daemon_path,s);
-  _dbus_string_get_dirname(&daemon_path,&bin_path);
-  _dbus_string_get_dirname(&bin_path,&dbusdir);
-  chdir(_dbus_string_get_const_data(&dbusdir));
-  _dbus_verbose ("Change working path to %s\n",_dbus_string_get_const_data (&dbusdir));
-  working_dir_init = 1;
-  return TRUE;
-}
-
-DBusString *_dbus_get_working_dir(void)
-{
-  if (!working_dir_init) 
-    return NULL;
-       
-  _dbus_verbose ("retrieving working path %s\n",_dbus_string_get_const_data (&dbusdir));
-  return &dbusdir;
-}
-
 /**
  * File interface
  *
@@ -1457,8 +1419,9 @@ _dbus_getsid(char **sid)
       _dbus_verbose("%s invalid sid\n",__FUNCTION__);
       goto failed;
     }
-okay:
+
   retval = TRUE;
+
 failed:
   if (process_token != NULL)
     CloseHandle (process_token);
@@ -3591,20 +3554,23 @@ again:
  */
 dbus_bool_t
 _dbus_read_credentials_socket  (int              handle,
-                                     DBusCredentials *credentials,
-                                     DBusError       *error)
+                                DBusCredentials *credentials,
+                                DBusError       *error)
 {
-  int bytes_read;
+  int bytes_read = 0;
   DBusString buf;
-  _dbus_string_init(&buf);
-
-  bytes_read = _dbus_read_socket(handle, &buf, 1 );
-  if (bytes_read > 0) 
+  
+  // could fail due too OOM
+  if (_dbus_string_init(&buf))
     {
-               _dbus_verbose("got one zero byte from server");
+      bytes_read = _dbus_read_socket(handle, &buf, 1 );
+
+      if (bytes_read > 0) 
+        _dbus_verbose("got one zero byte from server");
+
+      _dbus_string_free(&buf);
     }
 
-  _dbus_string_free(&buf);
   _dbus_credentials_add_from_current_process (credentials);
   _dbus_verbose("FIXME: get faked credentials from current process");