update binres tools and fix renaming bug

svn path=/trunk/; revision=10356
This commit is contained in:
Martin Fuchs 2004-08-02 07:59:38 +00:00
parent 5efcf7ad5c
commit da6bb56348

View file

@ -28,6 +28,7 @@
#include <ctype.h>
#include <string.h>
#include <sys/stat.h>
#include <limits.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
@ -182,8 +183,18 @@ int process_resources(const char* input_file_name, const char* specific_file_nam
if (inserting)
{
fclose(ftmp);
if (c == EOF && rename(tmp_file_name, input_file_name) < 0)
c = '.'; /* force an error */
if (c == EOF)
{
if (rename(tmp_file_name, input_file_name) < 0)
{
/* try unlinking first, Windows rename is brain-damaged */
if (unlink(input_file_name) < 0 || rename(tmp_file_name, input_file_name) < 0)
{
unlink(tmp_file_name);
return 0;
}
}
}
else unlink(tmp_file_name);
}
@ -197,7 +208,7 @@ int main(int argc, char **argv)
const char* input_file_name = 0;
const char* specific_file_name = 0;
while((optc = getopt(argc, argv, "axi:o:fh")) != EOF)
while((optc = getopt(argc, argv, "axi:o:fhv")) != EOF)
{
switch(optc)
{