* Bugfix of "rename" across volumes, now simply copies the file instead.
This commit is contained in:
parent
de57335296
commit
b3814af1ba
|
@ -43,17 +43,7 @@ void UNLINK(string x)
|
|||
#endif
|
||||
}
|
||||
|
||||
void RENAME(string x,string y)
|
||||
{
|
||||
/* Must move the file "x" to the file "y" */
|
||||
|
||||
#ifdef USE_SYS
|
||||
if(!sys_rename(x,y)) fatal(1,"Cannot rename to %s",y);
|
||||
#else
|
||||
if (rename(x, y) == -1)
|
||||
fatal(1, "Cannot rename to %s", y);
|
||||
#endif
|
||||
}
|
||||
|
||||
string libpath(string s)
|
||||
{
|
||||
|
|
|
@ -353,6 +353,28 @@ void copyfile(string file)
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
void copyto(string target, string source)
|
||||
{
|
||||
FILE *fsource;
|
||||
FILE *ftarget;
|
||||
int c;
|
||||
|
||||
ftarget = fopen(target,"wb+");
|
||||
if (ftarget == NULL)
|
||||
{
|
||||
fatal(0, "Cannot open file %s, call an expert", target);
|
||||
}
|
||||
fsource = fopen(source,"rb");
|
||||
if (fsource == NULL)
|
||||
{
|
||||
fatal(0, "Cannot open file %s, call an expert", source);
|
||||
}
|
||||
while ((c = getc(fsource)) != EOF)
|
||||
putc(c, ftarget);
|
||||
fclose(fsource);
|
||||
fclose(ftarget);
|
||||
}
|
||||
|
||||
void install(string target, string source)
|
||||
{
|
||||
/*
|
||||
|
@ -377,7 +399,7 @@ void install(string target, string source)
|
|||
if ((f2 = fopen(target, "r")) == NULL)
|
||||
{
|
||||
fclose(f1);
|
||||
RENAME(f_pars, target);
|
||||
copyto(target, f_pars);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
@ -406,6 +428,6 @@ void install(string target, string source)
|
|||
{
|
||||
fatal(0, "%s : not a file generated by LLgen", target);
|
||||
}
|
||||
RENAME(f_pars, target);
|
||||
copyto(target, f_pars);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue