mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Overwrite an already existing symlink
This commit is contained in:
parent
25525a6aae
commit
f2c2836301
1 changed files with 5 additions and 3 deletions
|
@ -142,6 +142,7 @@ int main(int argc, char **argv)
|
|||
const char *reldir;
|
||||
int left;
|
||||
boolean fileabs;
|
||||
const char *link;
|
||||
|
||||
logdir = D_Home();
|
||||
|
||||
|
@ -201,11 +202,12 @@ int main(int argc, char **argv)
|
|||
#ifdef __unix__
|
||||
logstream = fopen(logfilename, "w");
|
||||
#ifdef DEFAULTDIR
|
||||
if (symlink(logfilename,
|
||||
va("%s/"DEFAULTDIR"/latest-log.txt", logdir)) == -1)
|
||||
link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir);
|
||||
#else
|
||||
if (symlink(logfilename, va("%s/latest-log.txt", logdir)) == -1)
|
||||
link = va("%s/latest-log.txt", logdir);
|
||||
#endif/*DEFAULTDIR*/
|
||||
unlink(link);
|
||||
if (symlink(logfilename, link) == -1)
|
||||
{
|
||||
I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue