- 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)
This commit is contained in:
Randy Heit 2008-04-20 00:00:40 +00:00
parent 03b4f71edf
commit d7656bf73b
2 changed files with 38 additions and 1 deletions

View file

@ -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;
}

View file

@ -339,6 +339,38 @@
<File
RelativePath=".\updaterevision.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
DisableSpecificWarnings="4996"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
DisableSpecificWarnings="4996"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
DisableSpecificWarnings="4996"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
DisableSpecificWarnings="4996"
/>
</FileConfiguration>
</File>
</Files>
<Globals>