From d7656bf73bbbee9e447fcd322c5a3c5bafda2345 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 20 Apr 2008 00:00:40 +0000 Subject: [PATCH] - Fixed updaterevision for Vista: tmpnam() creates a path to the root directory of the drive, which is normally protected on Vista. The tempnam() function uses the TMP variable for a path instead. SVN r928 (trunk) --- tools/updaterevision/updaterevision.c | 7 ++++- tools/updaterevision/updaterevision.vcproj | 32 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/tools/updaterevision/updaterevision.c b/tools/updaterevision/updaterevision.c index d601c26efc..3f0dce4e9c 100644 --- a/tools/updaterevision/updaterevision.c +++ b/tools/updaterevision/updaterevision.c @@ -30,7 +30,7 @@ int main(int argc, char **argv) // 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. sprintf (run, "svnversion -cn %s", argv[1]); - if ((name = tmpnam(NULL)) != NULL && + if ((name = tempnam(NULL, "svnout")) != NULL && (stream = freopen(name, "w+b", stdout)) != NULL && system(run) == 0 && errno == 0 && @@ -45,9 +45,14 @@ int main(int argc, char **argv) fclose (stream); remove (name); } + if (name != NULL) + { + free (name); + } if (!gotrev) { + fprintf (stderr, "Failed to get current revision: %s\n", strerror(errno)); strcpy (currev, "0"); rev = currev; } diff --git a/tools/updaterevision/updaterevision.vcproj b/tools/updaterevision/updaterevision.vcproj index 202c9d042b..f3c1ebdf7a 100644 --- a/tools/updaterevision/updaterevision.vcproj +++ b/tools/updaterevision/updaterevision.vcproj @@ -339,6 +339,38 @@ + + + + + + + + + + + +