mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 17:29:28 +03:00
* direntry.c (vfs_s_retrieve_file): Allow interrupt by Ctrl-C.
From Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
This commit is contained in:
parent
9c1b6f52bd
commit
99800b2f24
@ -1,3 +1,8 @@
|
|||||||
|
2002-09-29 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* direntry.c (vfs_s_retrieve_file): Allow interrupt by Ctrl-C.
|
||||||
|
From Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
|
||||||
|
|
||||||
2002-09-26 Pavel Roskin <proski@gnu.org>
|
2002-09-26 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* sfs.c (sfs_init): Parametrize sfs.ini to allow reuse of the
|
* sfs.c (sfs_init): Parametrize sfs.ini to allow reuse of the
|
||||||
|
@ -923,7 +923,7 @@ vfs_s_close (void *fh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vfs_s_retrieve_file(vfs *me, struct vfs_s_inode *ino)
|
vfs_s_retrieve_file (vfs *me, struct vfs_s_inode *ino)
|
||||||
{
|
{
|
||||||
/* If you want reget, you'll have to open file with O_LINEAR */
|
/* If you want reget, you'll have to open file with O_LINEAR */
|
||||||
off_t total = 0;
|
off_t total = 0;
|
||||||
@ -932,7 +932,7 @@ vfs_s_retrieve_file(vfs *me, struct vfs_s_inode *ino)
|
|||||||
off_t stat_size = ino->st.st_size;
|
off_t stat_size = ino->st.st_size;
|
||||||
struct vfs_s_fh fh;
|
struct vfs_s_fh fh;
|
||||||
|
|
||||||
memset(&fh, 0, sizeof(fh));
|
memset (&fh, 0, sizeof (fh));
|
||||||
|
|
||||||
fh.ino = ino;
|
fh.ino = ino;
|
||||||
fh.handle = -1;
|
fh.handle = -1;
|
||||||
@ -947,32 +947,40 @@ vfs_s_retrieve_file(vfs *me, struct vfs_s_inode *ino)
|
|||||||
goto error_3;
|
goto error_3;
|
||||||
|
|
||||||
/* Clear the interrupt status */
|
/* Clear the interrupt status */
|
||||||
|
got_interrupt ();
|
||||||
|
enable_interrupt_key ();
|
||||||
|
|
||||||
while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof(buffer)))) {
|
while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof (buffer)))) {
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
goto error_1;
|
goto error_1;
|
||||||
|
|
||||||
total += n;
|
total += n;
|
||||||
vfs_print_stats (me->name, _("Getting file"), ino->ent->name, total, stat_size);
|
vfs_print_stats (me->name, _("Getting file"), ino->ent->name,
|
||||||
|
total, stat_size);
|
||||||
|
|
||||||
if (write(handle, buffer, n) < 0) {
|
if (got_interrupt ())
|
||||||
|
goto error_1;
|
||||||
|
|
||||||
|
if (write (handle, buffer, n) < 0) {
|
||||||
me->verrno = errno;
|
me->verrno = errno;
|
||||||
goto error_1;
|
goto error_1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MEDATA->linear_close (me, &fh);
|
MEDATA->linear_close (me, &fh);
|
||||||
close(handle);
|
close (handle);
|
||||||
|
|
||||||
|
disable_interrupt_key ();
|
||||||
return 0;
|
return 0;
|
||||||
error_1:
|
|
||||||
|
error_1:
|
||||||
MEDATA->linear_close (me, &fh);
|
MEDATA->linear_close (me, &fh);
|
||||||
error_3:
|
error_3:
|
||||||
disable_interrupt_key();
|
disable_interrupt_key ();
|
||||||
close(handle);
|
close (handle);
|
||||||
unlink(ino->localname);
|
unlink (ino->localname);
|
||||||
error_4:
|
error_4:
|
||||||
g_free(ino->localname);
|
g_free (ino->localname);
|
||||||
ino->localname = NULL;
|
ino->localname = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user