Fix the ftp bug reported by Andrej Borsenkow. If we have to keep

O_EXCL in retrieve_file_start2 then I will find a different fix.


Mon May  4 10:27:49 1998  Norbert Warmuth  <k3190@fh-sw.de>

* ftpfs.c (retrieve_file_start2): Don't create target file O_EXCL,
in copy_file_file we check existance of the target file and know
that we want to truncate it.


Mon May  4 10:21:31 1998  Norbert Warmuth  <k3190@fh-sw.de>

* file.c (copy_file_file): Schedule deletion of short target file
only when we created or truncated the target file and not already
when we decided to overwrite an existing file.
This commit is contained in:
Norbert Warmuth 1998-05-04 09:29:52 +00:00
parent 29726d03dc
commit 3b631ed12e
4 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Mon May 4 10:21:31 1998 Norbert Warmuth <k3190@fh-sw.de>
* file.c (copy_file_file): Schedule deletion of short target file
only when we created or truncated the target file and not already
when we decided to overwrite an existing file.
1998-05-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* boxes.c (task_cb): Use kill, not INT, as we are catching INT in

View File

@ -1078,8 +1078,8 @@ copy_file_file (char *src_path, char *dst_path, int ask_overwrite)
goto ret;
}
resources |= 2; /* dst_path exists/dst_path opened */
resources |= 4; /* remove short file */
}
resources |= 4; /* remove short file */
appending = do_append;
do_append = 0;
@ -1163,6 +1163,14 @@ copy_file_file (char *src_path, char *dst_path, int ask_overwrite)
i = 0;
break;
}
/* the first time we reach this line the target file has been created
or truncated and we actually have a short target file.
Do we really want to delete the target file when the ftp transfer
fails? If we don't delete it we would be able to use reget later.
(Norbert) */
resources |= 4; /* remove short file */
if (i && size != MCERR_DATA_ON_STDIN){
n_read_total += size;

View File

@ -1,3 +1,9 @@
Mon May 4 10:27:49 1998 Norbert Warmuth <k3190@fh-sw.de>
* ftpfs.c (retrieve_file_start2): Don't create target file O_EXCL,
in copy_file_file we check existance of the target file and know
that we want to truncate it.
1998-04-29 Miguel de Icaza <miguel@nuclecu.unam.mx>
* tar.c (read_header): Mark regular files with S_IFREG.

View File

@ -1630,7 +1630,7 @@ int retrieve_file_start(struct ftpentry *fe)
int retrieve_file_start2(struct ftpentry *fe)
{
remotelocal_handle = open(fe->local_filename, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
remotelocal_handle = open(fe->local_filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
if (remotelocal_handle == -1) {
ftpfserrno = EIO;
free(fe->local_filename);