mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-23 21:29:39 +03:00
files: when opening a file for copying, it should NOT be created
Weird bug. The first occurrence is probably never hit because the existing file has been tentatively opened fourteen lines earlier, but that looks superfluous: double work. And the second occurrence will not be hit because the temp file is unlikely to have disappeared.
This commit is contained in:
parent
0f98466e2f
commit
022cc084a7
@ -1738,7 +1738,7 @@ bool write_file(const char *name, FILE *stream, bool tmp,
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
fd_source = open(realname, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
fd_source = open(realname, O_RDONLY);
|
||||
|
||||
if (fd_source != -1) {
|
||||
f_source = fdopen(fd_source, "rb");
|
||||
@ -1864,7 +1864,7 @@ bool write_file(const char *name, FILE *stream, bool tmp,
|
||||
int fd_source;
|
||||
FILE *f_source = NULL;
|
||||
|
||||
fd_source = open(tempname, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
fd_source = open(tempname, O_RDONLY);
|
||||
|
||||
if (fd_source != -1) {
|
||||
f_source = fdopen(fd_source, "rb");
|
||||
|
Loading…
Reference in New Issue
Block a user