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

fix: fix creation of directories with absolute path on Windows #289

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

Mixaill
Copy link
Contributor

@Mixaill Mixaill commented Jun 10, 2020

Fix creation of directories which have drive letter in path.

supersedes #276
fixes #281

@@ -362,7 +362,7 @@ sentry__path_create_dir_all(const sentry_path_t *path)
memcpy(p, path->path, len * sizeof(wchar_t));

for (ptr = p; *ptr; ptr++) {
if ((*ptr == L'\\' || *ptr == L'/') && ptr != p) {
if ((*ptr == L'\\' || *ptr == L'/') && ptr != p && ptr[-1] != L':') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note, ptr[-1] is safe here, because ptr != p prevents execution when ptr points the start of the string

Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, this really looks cleaner than the other PR

@Swatinem Swatinem merged commit 19ad6e7 into getsentry:master Jun 10, 2020
@Mixaill Mixaill deleted the windows-absolutpath branch June 11, 2020 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sentry_init fails if database path on different drive
2 participants