From 0a0cdfd28c58fa87cbefa7ea6a6597cf7816136a Mon Sep 17 00:00:00 2001
From: Yuriy Gerasimov <yuri.gerasimov@gmail.com>
Date: Thu, 11 Aug 2011 11:10:41 +0300
Subject: [PATCH] Remove chdir() from services.runtime.inc.

---
 services.module      |    1 -
 services.runtime.inc |    9 ---------
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/services.module b/services.module
index e633f64..f9a0041 100644
--- a/services.module
+++ b/services.module
@@ -188,7 +188,6 @@ function services_endpoint_callback($endpoint_name) {
       'endpoint'      => $endpoint_name,
       'endpoint_path' => $endpoint->path,
       'debug'         => $endpoint->debug,
-      'drupal_path'   => getcwd(),
     ));
     if ($endpoint->debug) {
       watchdog('services', 'Calling server: %server', array('%server' => $server . '_server'), WATCHDOG_DEBUG);
diff --git a/services.runtime.inc b/services.runtime.inc
index 68a6439..27ba787 100644
--- a/services.runtime.inc
+++ b/services.runtime.inc
@@ -132,20 +132,11 @@ function services_controller_execute($controller, $args = array()) {
 
   // Call default or custom access callback
   if (call_user_func_array($controller['access callback'], $access_arguments) != TRUE) {
-    global $user;
     return services_error(t('Access denied for user @user', array(
       '@user' => isset($user->name) ? $user->name : 'anonymous',
     )), 401);
   }
 
-  // Change working directory to drupal root to call drupal function,
-  // then change it back to server module root to handle return.
-  $server_root = getcwd();
-  $drupal_path = services_get_server_info('drupal_path');
-  if (isset($drupal_path) && $drupal_path) {
-    chdir($drupal_path);
-  }
-
   // Check if the arguments should be preprocessed
   if (!empty($controller['endpoint']['preprocess'])) {
     foreach ($controller['endpoint']['preprocess'] as $callable) {
-- 
1.7.4.1

