[ros-rospack] 07/08: Replace PATH_MAX by getcwd(NULL, 0) in unit test

Jochen Sprickerhof jspricke at moszumanska.debian.org
Wed Jul 12 16:58:01 UTC 2017


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

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

commit 412a089da9dc77d11faf20f05bf1f316de674040
Author: Svante Signell <svante.signell at gmail.com>
Date:   Fri Sep 2 10:51:04 2016 +0200

    Replace PATH_MAX by getcwd(NULL, 0) in unit test
    
    
    Gbp-Pq: Name 0007-Replace-PATH_MAX-by-getcwd-NULL-0-in-unit-test.patch
---
 test/test/utest.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/test/utest.cpp b/test/test/utest.cpp
index 3f79357..96b1fa0 100644
--- a/test/test/utest.cpp
+++ b/test/test/utest.cpp
@@ -231,8 +231,8 @@ int main(int argc, char **argv)
   char buf[1024];
   std::string rr = std::string(getcwd(buf, sizeof(buf))) + "/test2";
   setenv("ROS_PACKAGE_PATH", rr.c_str(), 1);
-  char path[PATH_MAX];
-  if(getcwd(path,sizeof(path)))
+  char *path = getcwd(NULL, 0);
+  if(path)
   {
     boost::filesystem::path p(path);
     p = p.parent_path();
@@ -243,6 +243,7 @@ int main(int argc, char **argv)
     setenv("PATH", newpath.c_str(), 1);
   }
 
+  free(path);
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }

-- 
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