-
Notifications
You must be signed in to change notification settings - Fork 299
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
Possible fix for tmpnam. #308
base: master
Are you sure you want to change the base?
Conversation
Thanks Chris. Do we know if this works on all platforms? |
I am not certain. |
@@ -157,7 +157,8 @@ void LocalNameServers_findIps(LocalNameServers *self) | |||
|
|||
void LocalNameServers_findIps(LocalNameServers *self) | |||
{ | |||
char *path = tmpnam(NULL); | |||
char *path = 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.
Looks like there's a minor whitespace issue here.
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.
Funny, the whitespace doesn't show up incorrectly on my computer. Probably some issue with my vim configuration.
|
@stevedekorte It looks like it's supported at least on FreeBSD, Linux, OSX, and Solaris. |
Can anyone test it on Windows? |
Looks like it's deprecated on Windows.
|
If someone would like to mod the patch to work on windows, I can accept it. |
Hope you don't mind me jumping in but:
So I think you just need a solution for OS X, probably using |
Quick thought on using #include <stdio.h>
int main(void) {
static char answer[1024];
FILE* fp = popen("dig|grep SERVER:", "r");
if (fp) {
fread(answer, 1, 1024, fp);
/* Do something with 'answer' ... */
puts(answer);
pclose(fp);
} else {
/* Error */
}
} Tested on Linux, not yet on OS X. |
According to here you should not use
tmpnam
. I am not familiar with Socket programming, so I am not sure how to test. I believe I have fixed it by replacing it withmkstemp
, but I'm not completely sure. Nevertheless, this is an issue that should be addressed.