[PATCH 5/5] commandhelper: printCwd: Print result directly instead of copying it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/commandhelper.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index ee06339392..9b56feb120 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -221,9 +221,10 @@ static int printCwd(FILE *log)
     if (!(cwd = getcwd(NULL, 0)))
         return -1;

-    if ((strlen(cwd) > strlen(".../commanddata")) &&
-        (STREQ(cwd + strlen(cwd) - strlen("/commanddata"), "/commanddata"))) {
-        strcpy(cwd, ".../commanddata");
+    if ((display = strstr(cwd, "/commanddata")) &&
+        STREQ(display, "/commanddata")) {
+        fprintf(log, "CWD:.../commanddata\n");
+        return 0;
     }

     display = cwd;
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux