Index: zeroc-ice-package/cpp/src/IceUtil/FileUtil.cpp
===================================================================
--- zeroc-ice-package.orig/cpp/src/IceUtil/FileUtil.cpp	2013-12-17 23:46:05.498132525 +0100
+++ zeroc-ice-package/cpp/src/IceUtil/FileUtil.cpp	2013-12-17 23:46:05.494132498 +0100
@@ -13,6 +13,7 @@
 #include <IceUtil/Exception.h>
 #include <climits>
 #include <string.h>
+#include <memory>
 
 #ifdef _WIN32
 #  include <process.h>
@@ -221,7 +222,7 @@
     }
 #endif
     //
-    // In Windows implementation we don't write the process pid to the file, as it is 
+    // In Windows implementation we don't write the process pid to the file, as it is
     // not possible to read the file from other process while it is locked here.
     //
 }
@@ -237,7 +238,7 @@
 {
 }
 
-IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) : 
+IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) :
 #ifdef  __MINGW32__
     std::ifstream(path.c_str(), mode)
 #else
@@ -260,7 +261,7 @@
 {
 }
 
-IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) : 
+IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) :
 #ifdef __MINGW32__
     std::ofstream(path.c_str(), mode)
 #else
@@ -338,11 +339,15 @@
 int
 IceUtilInternal::getcwd(string& cwd)
 {
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+    std::auto_ptr<char> cwdbuf = get_current_dir_name();
+#else
     char cwdbuf[PATH_MAX];
     if(::getcwd(cwdbuf, PATH_MAX) == NULL)
     {
-        return -1;
+	return -1;
     }
+#endif
     cwd = cwdbuf;
     return 0;
 }
@@ -374,10 +379,10 @@
     lock.l_whence = SEEK_SET; // Begining of file
     lock.l_start = 0;
     lock.l_len = 0;
-    
+
     //
-    // F_SETLK tells fcntl to not block if it cannot 
-    // acquire the lock, if the lock cannot be acquired 
+    // F_SETLK tells fcntl to not block if it cannot
+    // acquire the lock, if the lock cannot be acquired
     // it returns -1 without wait.
     //
     if(::fcntl(_fd, F_SETLK, &lock) == -1)
@@ -391,14 +396,14 @@
     // If there is an error after here, we close the fd,
     // to release the lock.
     //
-    
+
     //
     // Now that we have acquire an excluxive write lock,
     // write the process pid there.
     //
     ostringstream os;
     os << getpid();
-    
+
     if(write(_fd, os.str().c_str(), os.str().size()) == -1)
     {
         IceUtil::FileLockException ex(__FILE__, __LINE__, errno, _path);
Index: zeroc-ice-package/cpp/src/IceUtil/Thread.cpp
===================================================================
--- zeroc-ice-package.orig/cpp/src/IceUtil/Thread.cpp	2013-12-17 23:46:05.498132525 +0100
+++ zeroc-ice-package/cpp/src/IceUtil/Thread.cpp	2013-12-17 23:46:05.494132498 +0100
@@ -7,7 +7,7 @@
 //
 // **********************************************************************
 
-#ifdef __sun 
+#ifdef __sun
 //
 // Solaris 10 bug: it's supposed to be defined in pthread.h
 //
@@ -83,7 +83,7 @@
     {
         throw BadThreadControlException(__FILE__, __LINE__);
     }
-    
+
     try
     {
         _thread->detach();
@@ -170,7 +170,7 @@
     }
 
     thread->_done();
-   
+
     return 0;
 }
 
@@ -211,7 +211,7 @@
 
     _started = true;
     _running = true;
-    
+
     return ThreadControl(_thread);
 }
 
@@ -303,7 +303,7 @@
     {
         throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
     }
-    
+
     detach();
 }
 
@@ -314,7 +314,7 @@
     {
         throw BadThreadControlException(__FILE__, __LINE__);
     }
-    
+
     if(CloseHandle(_handle) == 0)
     {
         throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
@@ -406,7 +406,7 @@
     }
 
     thread->_done();
-   
+
     return 0;
 }
 
@@ -443,14 +443,14 @@
     // __decRef().
     //
     __incRef();
-    
+
     unsigned int id;
-    _handle = 
+    _handle =
         reinterpret_cast<HANDLE>(
-            _beginthreadex(0, 
-                            static_cast<unsigned int>(stackSize), 
-                            startHook, this, 
-                            CREATE_SUSPENDED, 
+            _beginthreadex(0,
+                            static_cast<unsigned int>(stackSize),
+                            startHook, this,
+                            CREATE_SUSPENDED,
                             &id));
     _id = id;
     assert(_handle != (HANDLE)-1L);
@@ -471,7 +471,7 @@
 
     _started = true;
     _running = true;
-    
+
     return ThreadControl(_handle, _id);
 }
 
@@ -620,7 +620,7 @@
 {
 }
 
-extern "C" 
+extern "C"
 {
 static void*
 startHook(void* arg)
@@ -653,7 +653,7 @@
     }
 
     thread->_done();
-    
+
     return 0;
 }
 }
@@ -706,10 +706,13 @@
     }
     if(stackSize > 0)
     {
+
+#ifdef PTHREAD_STACK_MIN
         if(stackSize < PTHREAD_STACK_MIN)
         {
             stackSize = PTHREAD_STACK_MIN;
         }
+#endif
 #ifdef __APPLE__
         if(stackSize % 4096 > 0)
         {
@@ -717,12 +720,16 @@
         }
 #endif
         rc = pthread_attr_setstacksize(&attr, stackSize);
+// Missing pthread stack min indicates setstacksize will probably fail
+// (GNU/Hurd uses fixed size stacks). Let's just ignore it.
+#ifdef PTHREAD_STACK_MIN
         if(rc != 0)
         {
             __decRef();
             pthread_attr_destroy(&attr);
             throw ThreadSyscallException(__FILE__, __LINE__, rc);
         }
+#endif
     }
 
     if(realtimeScheduling)
Index: zeroc-ice-package/cpp/src/Slice/Util.cpp
===================================================================
--- zeroc-ice-package.orig/cpp/src/Slice/Util.cpp	2013-12-17 23:46:05.498132525 +0100
+++ zeroc-ice-package/cpp/src/Slice/Util.cpp	2013-12-17 23:48:11.386984570 +0100
@@ -12,6 +12,7 @@
 #include <IceUtil/FileUtil.h>
 #include <IceUtil/StringUtil.h>
 #include <climits>
+#include <memory>
 
 #include <unistd.h> // For readlink()
 
@@ -114,7 +115,11 @@
             subpath = result.substr(0, next);
         }
 
+#ifdef PATH_MAX
         char buf[PATH_MAX + 1];
+#else
+	auto_ptr<char> buf = new char[pathconf ("/", _PC_PATH_MAX) + 1];
+#endif
         int len = static_cast<int>(readlink(subpath.c_str(), buf, sizeof(buf)));
         if(len > 0)
         {
