[ros-rospack] 06/07: Fix FTBFS on hurd-i386

Jochen Sprickerhof jspricke-guest at moszumanska.debian.org
Tue Jul 26 16:31:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

jspricke-guest pushed a commit to branch patch-queue/master
in repository ros-rospack.

commit 13b0d63f3384b481c26b5763a742b3d07b84535e
Author: Svante Signell <svante.signell at gmail.com>
Date:   Sat Jun 18 18:06:07 2016 +0200

    Fix FTBFS on hurd-i386
    
    
    Gbp-Pq: Name 0005-Fix-FTBFS-on-hurd-i386.patch
---
 src/rospack.cpp | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/rospack.cpp b/src/rospack.cpp
index 0662cba..750471f 100644
--- a/src/rospack.cpp
+++ b/src/rospack.cpp
@@ -2011,11 +2011,14 @@ Rosstackage::writeCache()
   }
   else
   {
-    char tmp_cache_dir[PATH_MAX];
-    char tmp_cache_path[PATH_MAX];
-    strncpy(tmp_cache_dir, cache_path.c_str(), sizeof(tmp_cache_dir));
+    int len = cache_path.size() + 1;
+    char *tmp_cache_dir = (char *)malloc(len);
+    strncpy(tmp_cache_dir, cache_path.c_str(), len);
+    // make sure tmp_cache_dir is NULL terminated
+    tmp_cache_dir[len - 1] = '\0';
 #if defined(_MSC_VER)
     // No dirname on Windows; use _splitpath_s instead
+    char tmp_cache_path[PATH_MAX];
     char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
     _splitpath_s(tmp_cache_dir, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME,
                  ext, _MAX_EXT);
@@ -2023,11 +2026,18 @@ Rosstackage::writeCache()
     _makepath_s(full_dir, _MAX_DRIVE + _MAX_DIR, drive, dir, NULL, NULL);
     snprintf(tmp_cache_path, sizeof(tmp_cache_path), "%s\\.rospack_cache.XXXXXX", full_dir);
 #elif defined(__MINGW32__)
+    char tmp_cache_path[PATH_MAX];
     char* temp_name = tempnam(dirname(tmp_cache_dir),".rospack_cache.");
     snprintf(tmp_cache_path, sizeof(tmp_cache_path), temp_name);
     delete temp_name;
 #else
-    snprintf(tmp_cache_path, sizeof(tmp_cache_path), "%s/.rospack_cache.XXXXXX", dirname(tmp_cache_dir));
+    char *tmp_cache_path = NULL;
+    char *temp_dirname = strdup(dirname(tmp_cache_dir));
+    free(tmp_cache_dir);
+    len = strlen(temp_dirname) + 22 + 1;
+    tmp_cache_path = (char *)malloc(len);
+    snprintf(tmp_cache_path, len, "%s/.rospack_cache.XXXXXX", temp_dirname);
+    free(temp_dirname);
 #endif
 #if defined(__MINGW32__)
     // There is no equivalent of mkstemp or _mktemp_s on mingw, so we resort to a slightly problematic
@@ -2085,6 +2095,9 @@ Rosstackage::writeCache()
         }
       }
     }
+#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(WIN32)
+		 free(tmp_cache_path);
+#endif
   }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ros/ros-rospack.git



More information about the debian-science-commits mailing list