Skip to content

Commit

Permalink
uftrace: Move logfile path to uftrace.data
Browse files Browse the repository at this point in the history
Ensure that when using "--logfile=<name>", the logfile is created
inside the uftrace.data directory.

Additionally, when using both "--host" and "--logfile" options
simultaneously on the client, the logfile in the uftrace.data
directory is sent to the host.

Fixed: namhyung#831

Signed-off-by: Rihyeon Kim <[email protected]>
  • Loading branch information
dlgus8648 committed Oct 8, 2024
1 parent feff2af commit 68b559f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion uftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,9 +1592,15 @@ int main(int argc, char *argv[])
wait_for_pager();

cleanup:
if (opts.logfile)
if (opts.logfile) {
char *logfile_path = NULL;
fclose(logfp);

xasprintf(&logfile_path, "%s/%s", opts.dirname, opts.logfile);
copy_file(opts.logfile, logfile_path);

free(logfile_path);
}
if (opts.opt_file)
free_parsed_cmdline(argv - opts.idx);

Expand Down

0 comments on commit 68b559f

Please sign in to comment.