* vfs.c (mc_[un]def_getlocalcopy): better error handling on writing

--------------------------------------------------------------
This commit is contained in:
Pavel Machek 2000-05-25 14:47:48 +00:00
parent 65a83ff8b4
commit b1185ecc73
2 changed files with 12 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2000-05-23 Andrew V. Samoilov <sav@bcs.zp.ua>
* vfs.c (mc_[un]def_getlocalcopy): better error handling on writing
2000-05-18 Andrew V. Samoilov <sav@bcs.zp.ua>
* ftpfs.c: (my_get_host_and_username) space between macro name and

View File

@ -1064,12 +1064,12 @@ mc_def_getlocalcopy (vfs *vfs, char *filename)
fdout = open (tmp, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, 0600);
if (fdout == -1)
goto fail;
while ((i = mc_read (fdin, buffer, sizeof (buffer))) > 0)
write (fdout, buffer, i);
while ((i = mc_read (fdin, buffer, sizeof (buffer))) > 0){
if (write (fdout, buffer, i) != i)
goto fail;
}
if (i == -1)
goto fail;
if (write (fdout, buffer, i)==-1)
goto fail;
i = mc_close (fdin);
fdin = -1;
if (i==-1)
@ -1117,15 +1117,13 @@ mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed)
fdout = mc_open (filename, O_WRONLY | O_TRUNC);
if (fdout == -1)
goto failed;
while ((i = read (fdin, buffer, sizeof (buffer))) == sizeof (buffer)){
mc_write (fdout, buffer, i);
}
while ((i = read (fdin, buffer, sizeof (buffer))) > 0){
if (mc_write (fdout, buffer, i) != i)
goto failed;
}
if (i == -1)
goto failed;
if (mc_write (fdout, buffer, i) == -1)
goto failed;
if (close (fdin)==-1)
goto failed;
if (mc_close (fdout)==-1) {
@ -1322,7 +1320,6 @@ vfs_split_text (char *p)
char *original = p;
int numcols;
for (numcols = 0; *p && numcols < MAXCOLS; numcols++){
while (*p == ' ' || *p == '\r' || *p == '\n'){
*p = 0;