- 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:
Christoph Oelckers 2010-02-14 08:13:50 +00:00
parent 6ec30761c6
commit 8a843e4b3c

View file

@ -30,8 +30,13 @@ 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 && {
#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 && system(run) == 0 &&
errno == 0 && errno == 0 &&
fseek(stream, 0, SEEK_SET) == 0 && fseek(stream, 0, SEEK_SET) == 0 &&
@ -40,6 +45,7 @@ int main(int argc, char **argv)
{ {
gotrev = 1; gotrev = 1;
} }
}
if (stream != NULL) if (stream != NULL)
{ {
fclose (stream); fclose (stream);