Skip to content
Snippets Groups Projects
Commit f2c28363 authored by James R.'s avatar James R.
Browse files

Overwrite an already existing symlink

parent 25525a6a
No related branches found
No related tags found
2 merge requests!734Rebase Keycodes only branch.,!567haha log files
...@@ -142,6 +142,7 @@ int main(int argc, char **argv) ...@@ -142,6 +142,7 @@ int main(int argc, char **argv)
const char *reldir; const char *reldir;
int left; int left;
boolean fileabs; boolean fileabs;
const char *link;
logdir = D_Home(); logdir = D_Home();
...@@ -201,11 +202,12 @@ int main(int argc, char **argv) ...@@ -201,11 +202,12 @@ int main(int argc, char **argv)
#ifdef __unix__ #ifdef __unix__
logstream = fopen(logfilename, "w"); logstream = fopen(logfilename, "w");
#ifdef DEFAULTDIR #ifdef DEFAULTDIR
if (symlink(logfilename, link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir);
va("%s/"DEFAULTDIR"/latest-log.txt", logdir)) == -1)
#else #else
if (symlink(logfilename, va("%s/latest-log.txt", logdir)) == -1) link = va("%s/latest-log.txt", logdir);
#endif/*DEFAULTDIR*/ #endif/*DEFAULTDIR*/
unlink(link);
if (symlink(logfilename, link) == -1)
{ {
I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno)); I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment