diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2018-03-02 00:39:46 +0000 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2018-03-02 00:39:46 +0000 |
commit | 952761081f2a2a9631352a3edf2f410e0e36c9be (patch) | |
tree | d24fc92a22e284bedc1b1626b1a871bc75850fac /src/LYUtils.c | |
parent | b518192561f738e5249e4f1e38ed0cdc2f059e0f (diff) | |
download | lynx-snapshots-952761081f2a2a9631352a3edf2f410e0e36c9be.tar.gz |
snapshot of project "lynx", label v2-8-9dev_16k
Diffstat (limited to 'src/LYUtils.c')
-rw-r--r-- | src/LYUtils.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/LYUtils.c b/src/LYUtils.c index 61dc1c5d..7a12ae66 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYUtils.c,v 1.279 2018/02/15 01:54:02 tom Exp $ + * $LynxId: LYUtils.c,v 1.280 2018/03/01 22:14:57 Takeshi.Hataguchi Exp $ */ #include <HTUtils.h> #include <HTTCP.h> @@ -7099,6 +7099,26 @@ void LYAddHtmlSep0(char *path) } /* + * Rename a file + */ +int LYRenameFile(char *src, + char *dst) +{ +#ifdef _WINDOWS + /* + * If dest_file exists prior to calling rename(), rename() will fail on Windows platforms. + * https://www.securecoding.cert.org/confluence/display/c/FIO10-C.+Take+care+when+using+the+rename%28%29+function + */ + struct stat st; + + if (stat(dst, &st) == 0) { + unlink(dst); + } +#endif + return rename(src, dst); +} + +/* * Copy a file */ int LYCopyFile(char *src, |