From 7c416dd41554297c9f0d76ecfb592bc40c71b5d0 Mon Sep 17 00:00:00 2001
From: Benjamin Renard <benjamin.renard@akka.eu>
Date: Tue, 2 Jun 2015 11:29:01 +0200
Subject: [PATCH] Fix some bugs with cmake configuration files + Fix a bug during get data request (update the current opened file)

---
 .gitignore                | 1 +
 CMakeLists.txt            | 3 +++
 src/SERVER/CMakeLists.txt | 1 -
 src/SERVER/DD_GetData.c   | 3 +++
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 9564a59..394045f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+.project
 build/
 scripts/StartServer
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9751394..5fedf9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,16 +2,19 @@ cmake_minimum_required(VERSION 2.6)
 
 PROJECT(DDServer)
 
+add_definitions( -DLINUX )
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/bin/)
 set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/lib/)
 
 if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
   #64 bits
+  MESSAGE( STATUS "64 bits" )
   set(CMAKE_C_FLAGS_DEBUG "-ggdb -DLINUX -Dlinux -m64 -march=core2 -fPIC -D_REENTRANT -pthread")
   set(CMAKE_C_FLAGS_RELEASE "-DLINUX -Dlinux -m64 -march=core2 -fPIC -D_REENTRANT -pthread")
   set(USRLIB_DIR "/usr/lib64/:/usr/local/lib64/")
 else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
   #32 bits
+  MESSAGE( STATUS "32 bits" )
   set(CMAKE_C_FLAGS_DEBUG "-ggdb -DLINUX -march=i686 -fPIC -Dlinux -D_REENTRANT -malign-double -pthread")
   set(CMAKE_C_FLAGS_DEBUG "-DLINUX -march=i686 -fPIC -Dlinux -D_REENTRANT -malign-double -pthread")
   set(USRLIB_DIR "/usr/lib/:/usr/local/lib/")
diff --git a/src/SERVER/CMakeLists.txt b/src/SERVER/CMakeLists.txt
index b5ca5aa..2fbe06a 100644
--- a/src/SERVER/CMakeLists.txt
+++ b/src/SERVER/CMakeLists.txt
@@ -21,7 +21,6 @@ target_link_libraries(
   DD_Client
   ${NETCDFLIBRARY}
   ${CRYPT_LIBRARY}
-  mpi
 )
 
 install (TARGETS DD_Server DESTINATION bin)
diff --git a/src/SERVER/DD_GetData.c b/src/SERVER/DD_GetData.c
index f06c055..2ab7ce3 100755
--- a/src/SERVER/DD_GetData.c
+++ b/src/SERVER/DD_GetData.c
@@ -969,6 +969,9 @@ int GetAttribute(int ID, char *VarName)
                   DD_Var[ID]->LastPacketFlag = MOREDATA;
                   DD_Var[ID]->NewFile = 1;         // We have to reset all variables
                   DD_Var[ID]->NewFileWasOpen = 1;
+                  //BRE - Update the current opened file
+                  DD_Var[ID]->CurrCushN = Local.CurrCushN;
+                  DD_Var[ID]->ncID = Local.ncID;
 		  if(Verbose) fprintf(stderr,"GetMultiData(ID=%d), Retun by EOF, MOREDATA, DD_Var[ID]->VarData = %p\n",ID,DD_Var[ID]->VarData);
                   return MOREDATA;
                 case TRYAGAIN:   // just wait and try again
--
libgit2 0.21.2