Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve full path of pcap which starts with '~' #607

Merged
merged 18 commits into from
Jul 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
96ae0c4
Add support for pcap paths with '~'
rajeshsingh381 Feb 20, 2023
9f3a949
Move the '~' expansion code into a function, support cases
rajeshsingh381 Mar 14, 2023
8c54d8c
Formatting
rajesingh Mar 14, 2023
244dccc
Merge branch 'master' into pcap_tilde_path_support
rajeshsingh381 Apr 9, 2023
ae0e73c
Expand user home path from find_file(), call it always regardless of …
rajeshsingh381 Apr 9, 2023
6ce9ea0
Merge branch 'SIPp:master' into pcap_tilde_path_support
rajeshsingh381 Jun 15, 2024
9333f8d
Fix rtpstream local port allocation
viktike Jun 25, 2024
e9a0921
Bump actions/upload-artifact from 4.3.3 to 4.3.4
dependabot[bot] Jul 8, 2024
171847f
Use filename as it is if path expansion was not successful
rajeshsingh381 Jul 16, 2024
9f45b7e
Blend with existing coding guidelines
rajeshsingh381 Jul 16, 2024
103aa60
Make entire pr blend with coding recommendations
rajeshsingh381 Jul 16, 2024
b18e714
Eliminate the case where no file name is passed
rajeshsingh381 Jul 16, 2024
648fec5
Evaluate expand_user_path() return code
rajeshsingh381 Jul 16, 2024
dca5e5d
Remove unused import. Don't call free on a char array
rajeshsingh381 Jul 17, 2024
e41920b
Revert "Fix rtpstream local port allocation"
rajeshsingh381 Jul 18, 2024
1e71a9f
Don't use dynamic array size as it is a GNU extension, Free memory as…
rajeshsingh381 Jul 18, 2024
244a170
Initialize pointer directly to value instead of NULL
rajeshsingh381 Jul 30, 2024
7e14bad
Merge branch 'master' into pcap_tilde_path_support
rajeshsingh381 Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/fileutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,27 @@ char* find_file(const char* filename)
{
char tmppath[MAX_PATH];
tmppath[0] = '\0';
const char *filepathptr = tmppath;
expand_user_path(filename, tmppath, sizeof(tmppath));
if(tmppath[0] == '\0')
{
filepathptr = filename;
}
rajeshsingh381 marked this conversation as resolved.
Show resolved Hide resolved

if (tmppath[0] == '/' || !*scenario_path) {
return strdup(tmppath);
if (filepathptr[0] == '/' || !*scenario_path) {
return strdup(filepathptr);
}

size_t len = strlen(scenario_path) + strlen(tmppath) + 1;
size_t len = strlen(scenario_path) + strlen(filepathptr) + 1;
char *fullpath = malloc(len);
snprintf(fullpath, len, "%s%s", scenario_path, filename);
snprintf(fullpath, len, "%s%s", scenario_path, filepathptr);

if (access(fullpath, R_OK) < 0) {
free(fullpath);
WARNING("SIPp now prefers looking for pcap/rtpstream files next to the scenario. "
"%s couldn't be found next to the scenario, falling back to "
"using the current working directory", filename);
return strdup(filename);
"using the current working directory", filepathptr);
return strdup(filepathptr);
}

return fullpath;
Expand Down