commandhelper: printCwd: Print result directly instead of copying it

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-03-03 11:36:22 +01:00
parent 4851a99ee0
commit 479f92ae16

View File

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