mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-30 13:20:52 +00:00
- tempnam would set the errno to 2 on the Mac even though everything seemed to be working as expected.
SVN r2161 (trunk)
This commit is contained in:
parent
6ec30761c6
commit
8a843e4b3c
1 changed files with 14 additions and 8 deletions
|
@ -30,15 +30,21 @@ int main(int argc, char **argv)
|
||||||
// Use svnversion to get the revision number. If that fails, pretend it's
|
// Use svnversion to get the revision number. If that fails, pretend it's
|
||||||
// revision 0. Note that this requires you have the command-line svn tools installed.
|
// revision 0. Note that this requires you have the command-line svn tools installed.
|
||||||
sprintf (run, "svnversion -cn %s", argv[1]);
|
sprintf (run, "svnversion -cn %s", argv[1]);
|
||||||
if ((name = tempnam(NULL, "svnout")) != NULL &&
|
if ((name = tempnam(NULL, "svnout")) != NULL)
|
||||||
(stream = freopen(name, "w+b", stdout)) != NULL &&
|
|
||||||
system(run) == 0 &&
|
|
||||||
errno == 0 &&
|
|
||||||
fseek(stream, 0, SEEK_SET) == 0 &&
|
|
||||||
fgets(currev, sizeof currev, stream) == currev &&
|
|
||||||
(isdigit(currev[0]) || (currev[0] == '-' && currev[1] == '1')))
|
|
||||||
{
|
{
|
||||||
gotrev = 1;
|
#ifdef __APPLE__
|
||||||
|
// tempnam will return errno of 2 even though it is successful for our purposes.
|
||||||
|
errno = 0;
|
||||||
|
#endif
|
||||||
|
if((stream = freopen(name, "w+b", stdout)) != NULL &&
|
||||||
|
system(run) == 0 &&
|
||||||
|
errno == 0 &&
|
||||||
|
fseek(stream, 0, SEEK_SET) == 0 &&
|
||||||
|
fgets(currev, sizeof currev, stream) == currev &&
|
||||||
|
(isdigit(currev[0]) || (currev[0] == '-' && currev[1] == '1')))
|
||||||
|
{
|
||||||
|
gotrev = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (stream != NULL)
|
if (stream != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue