-
Notifications
You must be signed in to change notification settings - Fork 44
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 windows chdir behavior #365
Conversation
src/harness/harness.c
Outdated
result = chdir(root_dir); | ||
if (result != 0) { | ||
LOG_PANIC("Failed to chdir. Error is %s", strerror(errno)); | ||
if (root_dir != NULL && strlen(root_dir) > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On discord, you said "."
worked.
What about only ignoring an empty root_dir
?
if (root_dir != NULL && strlen(root_dir) > 1) { | |
if (root_dir != NULL && root_dir[0] != '\0') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was if the value is .
, we don't need to call chdir since it is a no-op. I suppose I could do a strcmp(root_dir, '.')
to make that more obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a no-op, but I don't think we should care. chdir
's implementation should be able to handle it.
The current change would disallow one-letter directories.
An unlikely directory structure, but possible.
@@ -220,6 +220,10 @@ void GLRenderer_Init(int pRender_width, int pRender_height) { | |||
LOG_INFO("OpenGL version string: %s", glGetString(GL_VERSION)); | |||
LOG_INFO("OpenGL shading language version string: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); | |||
|
|||
if (glGetString(GL_SHADING_LANGUAGE_VERSION) == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this resolves a null pointer error inside glCreateProgram
later on inside my windows VM which doesn't expose gl shaders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What OpenGL version does the vm expose?
But you're probably correct to test capabilities instead of requiring a minimum OpenGL version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my last comment, LGTM!
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
thanks for the spotting! I must be tired today :) |
argv[0]
was expected to include the full path to the dethrace executable. On windows, this is not true, and only includes the filename.As a fix, we should only try to
chdir
ifroot_dir
is not empty or a single character.