1
1

* file.c (copy_file_file): Fix data corruption if mc_write()

does not write n_read bytes at once.
(move_file_file): Eliminate retry_src_lstat label.
Этот коммит содержится в:
Andrew V. Samoilov 2003-03-26 09:59:37 +00:00
родитель 6851c22f74
Коммит 904e4022a4
2 изменённых файлов: 15 добавлений и 10 удалений

Просмотреть файл

@ -1,3 +1,9 @@
2003-03-26 Andrew V. Samoilov <sav@bcs.zp.ua>
* file.c (copy_file_file): Fix data corruption if mc_write()
does not write n_read bytes at once.
(move_file_file): Eliminate retry_src_lstat label.
2003-03-24 Andrew V. Samoilov <sav@bcs.zp.ua>
* view.c (get_line_at): Set prev properly for reverse search.

Просмотреть файл

@ -715,6 +715,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path,
gettimeofday (&tv_current, NULL);
if (n_read > 0) {
char *t = buf;
n_read_total += n_read;
/* Windows NT ftp servers report that files have no
@ -729,18 +730,18 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path,
/* dst_write */
while ((n_written =
mc_write (dest_desc, buf, n_read)) < n_read) {
mc_write (dest_desc, t, n_read)) < n_read) {
if (n_written > 0) {
n_read -= n_written;
t += n_written;
continue;
}
return_status =
file_error (_
(" Cannot write target file \"%s\" \n %s "),
dst_path);
if (return_status == FILE_RETRY)
continue;
goto ret;
if (return_status != FILE_RETRY)
goto ret;
}
}
@ -1119,14 +1120,12 @@ move_file_file (FileOpContext *ctx, char *s, char *d,
mc_refresh ();
retry_src_lstat:
if (mc_lstat (s, &src_stats) != 0) {
while (mc_lstat (s, &src_stats) != 0) {
/* Source doesn't exist */
return_status =
file_error (_(" Cannot stat file \"%s\" \n %s "), s);
if (return_status == FILE_RETRY)
goto retry_src_lstat;
return return_status;
if (return_status != FILE_RETRY)
return return_status;
}
if (mc_lstat (d, &dst_stats) == 0) {