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> 2003-03-24 Andrew V. Samoilov <sav@bcs.zp.ua>
* view.c (get_line_at): Set prev properly for reverse search. * 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); gettimeofday (&tv_current, NULL);
if (n_read > 0) { if (n_read > 0) {
char *t = buf;
n_read_total += n_read; n_read_total += n_read;
/* Windows NT ftp servers report that files have no /* 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 */ /* dst_write */
while ((n_written = 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) { if (n_written > 0) {
n_read -= n_written; n_read -= n_written;
t += n_written;
continue; continue;
} }
return_status = return_status =
file_error (_ file_error (_
(" Cannot write target file \"%s\" \n %s "), (" Cannot write target file \"%s\" \n %s "),
dst_path); dst_path);
if (return_status == FILE_RETRY) if (return_status != FILE_RETRY)
continue; goto ret;
goto ret;
} }
} }
@ -1119,14 +1120,12 @@ move_file_file (FileOpContext *ctx, char *s, char *d,
mc_refresh (); mc_refresh ();
retry_src_lstat: while (mc_lstat (s, &src_stats) != 0) {
if (mc_lstat (s, &src_stats) != 0) {
/* Source doesn't exist */ /* Source doesn't exist */
return_status = return_status =
file_error (_(" Cannot stat file \"%s\" \n %s "), s); file_error (_(" Cannot stat file \"%s\" \n %s "), s);
if (return_status == FILE_RETRY) if (return_status != FILE_RETRY)
goto retry_src_lstat; return return_status;
return return_status;
} }
if (mc_lstat (d, &dst_stats) == 0) { if (mc_lstat (d, &dst_stats) == 0) {