* vfs.c (mc_[un]def_getlocalcopy): better error handling on writing
--------------------------------------------------------------
Этот коммит содержится в:
родитель
65a83ff8b4
Коммит
b1185ecc73
@ -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>
|
2000-05-18 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
* ftpfs.c: (my_get_host_and_username) space between macro name and
|
* ftpfs.c: (my_get_host_and_username) space between macro name and
|
||||||
|
19
vfs/vfs.c
19
vfs/vfs.c
@ -1064,12 +1064,12 @@ mc_def_getlocalcopy (vfs *vfs, char *filename)
|
|||||||
fdout = open (tmp, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, 0600);
|
fdout = open (tmp, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, 0600);
|
||||||
if (fdout == -1)
|
if (fdout == -1)
|
||||||
goto fail;
|
goto fail;
|
||||||
while ((i = mc_read (fdin, buffer, sizeof (buffer))) > 0)
|
while ((i = mc_read (fdin, buffer, sizeof (buffer))) > 0){
|
||||||
write (fdout, buffer, i);
|
if (write (fdout, buffer, i) != i)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (write (fdout, buffer, i)==-1)
|
|
||||||
goto fail;
|
|
||||||
i = mc_close (fdin);
|
i = mc_close (fdin);
|
||||||
fdin = -1;
|
fdin = -1;
|
||||||
if (i==-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);
|
fdout = mc_open (filename, O_WRONLY | O_TRUNC);
|
||||||
if (fdout == -1)
|
if (fdout == -1)
|
||||||
goto failed;
|
goto failed;
|
||||||
while ((i = read (fdin, buffer, sizeof (buffer))) == sizeof (buffer)){
|
while ((i = read (fdin, buffer, sizeof (buffer))) > 0){
|
||||||
mc_write (fdout, buffer, i);
|
if (mc_write (fdout, buffer, i) != i)
|
||||||
}
|
goto failed;
|
||||||
|
}
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
if (mc_write (fdout, buffer, i) == -1)
|
|
||||||
goto failed;
|
|
||||||
|
|
||||||
if (close (fdin)==-1)
|
if (close (fdin)==-1)
|
||||||
goto failed;
|
goto failed;
|
||||||
if (mc_close (fdout)==-1) {
|
if (mc_close (fdout)==-1) {
|
||||||
@ -1322,7 +1320,6 @@ vfs_split_text (char *p)
|
|||||||
char *original = p;
|
char *original = p;
|
||||||
int numcols;
|
int numcols;
|
||||||
|
|
||||||
|
|
||||||
for (numcols = 0; *p && numcols < MAXCOLS; numcols++){
|
for (numcols = 0; *p && numcols < MAXCOLS; numcols++){
|
||||||
while (*p == ' ' || *p == '\r' || *p == '\n'){
|
while (*p == ' ' || *p == '\r' || *p == '\n'){
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user