Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Stefan Strogin
flac
Commits
9acc35fe
Commit
9acc35fe
authored
Sep 16, 2006
by
Josh Coalson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix problem on windows where rename() fails if destination exists
parent
180e0cac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
src/flac/main.c
src/flac/main.c
+12
-0
No files found.
src/flac/main.c
View file @
9acc35fe
...
...
@@ -1776,8 +1776,20 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
/* rename temporary file if necessary */
if
(
retval
==
0
&&
internal_outfilename
!=
0
)
{
if
(
rename
(
internal_outfilename
,
outfilename
)
<
0
)
{
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
/* on some flavors of windows, rename() will fail if the destination already exists, so we unlink and try again */
if
(
unlink
(
outfilename
)
<
0
)
{
flac__utils_printf
(
stderr
,
1
,
"ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both
\n
"
,
internal_outfilename
,
outfilename
);
retval
=
1
;
}
else
if
(
rename
(
internal_outfilename
,
outfilename
)
<
0
)
{
flac__utils_printf
(
stderr
,
1
,
"ERROR: moving new FLAC file %s back on top of original FLAC file %s, you must do it
\n
"
,
internal_outfilename
,
outfilename
);
retval
=
1
;
}
#else
flac__utils_printf
(
stderr
,
1
,
"ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both
\n
"
,
internal_outfilename
,
outfilename
);
retval
=
1
;
#endif
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment