<div dir="ltr">The get_current_dir_name() function is a GNU C extension that copies<div>the current directory's absolute path into a memory allocated buffer.</div><div>This patch replaces get_current_dir_name() with a POSIX compliant</div><div>getcwd() that performs the same action.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 28, 2022 at 7:40 AM Kamil Konieczny <<a href="mailto:kamil.konieczny@linux.intel.com">kamil.konieczny@linux.intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Jake,<br>
<br>
please put here shot commit description, the patch itself<br>
looks good.<br>
<br>
Regrads,<br>
Kamil<br>
<br>
On 2022-09-18 at 17:39:55 -0500, Jake Freeland wrote:<br>
> Signed-off-by: Jake Freeland <<a href="mailto:jfree@freebsd.org" target="_blank">jfree@freebsd.org</a>><br>
> ---<br>
> tests/tools_test.c | 6 +++---<br>
> tools/i915-perf/i915_perf_control.c | 2 +-<br>
> 2 files changed, 4 insertions(+), 4 deletions(-)<br>
> <br>
> diff --git a/tests/tools_test.c b/tests/tools_test.c<br>
> index 89a19d11..d0684d57 100644<br>
> --- a/tests/tools_test.c<br>
> +++ b/tests/tools_test.c<br>
> @@ -69,7 +69,7 @@ static bool chdir_to_tools_dir(void)<br>
> char path[PATH_MAX];<br>
> char *cwd;<br>
> <br>
> - cwd = get_current_dir_name();<br>
> + cwd = getcwd(NULL, 0);<br>
> igt_info("Current working directory: %s\n", cwd);<br>
> free(cwd);<br>
> <br>
> @@ -87,7 +87,7 @@ static bool chdir_to_tools_dir(void)<br>
> chdir(dirname(path));<br>
> }<br>
> <br>
> - cwd = get_current_dir_name();<br>
> + cwd = getcwd(NULL, 0);<br>
> igt_info("Current working directory: %s\n", cwd);<br>
> free(cwd);<br>
> <br>
> @@ -103,7 +103,7 @@ igt_main<br>
> <br>
> igt_require_f(chdir_to_tools_dir(),<br>
> "Unable to determine the tools directory, expecting them in $cwd/" TOOLS " or $path/" TOOLS "\n");<br>
> - path = get_current_dir_name();<br>
> + path = getcwd(NULL, 0);<br>
> igt_info("Using tools from %s\n", path);<br>
> free(path);<br>
> }<br>
> diff --git a/tools/i915-perf/i915_perf_control.c b/tools/i915-perf/i915_perf_control.c<br>
> index be5996c0..f7db2f5c 100644<br>
> --- a/tools/i915-perf/i915_perf_control.c<br>
> +++ b/tools/i915-perf/i915_perf_control.c<br>
> @@ -102,7 +102,7 @@ main(int argc, char *argv[])<br>
> <br>
> fwrite(data, total_len, 1, command_fifo_file);<br>
> } else {<br>
> - char *cwd = get_current_dir_name();<br>
> + char *cwd = getcwd(NULL, 0);<br>
> uint32_t path_len = strlen(cwd) + 1 + strlen(dump_file) + 1;<br>
> uint32_t total_len = sizeof(struct recorder_command_base) + path_len;<br>
> struct {<br>
> -- <br>
> 2.37.3<br>
> <br>
</blockquote></div>