mirror of https://github.com/MidnightCommander/mc
* vfs/fish.c (fish_linear_start): Fix a hang when retrieving unreadable
file. Fixes savannah bug #21331.
This commit is contained in:
parent
f5c8203418
commit
4a895496c7
|
@ -1,3 +1,8 @@
|
|||
2007-10-26 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* fish.c (fish_linear_start): Fix a hang when retrieving unreadable
|
||||
file. Fixes savannah bug #21331.
|
||||
|
||||
2007-10-11 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* fish.c (fish_linear_start): Use strtol() or strtoll() to retrieve
|
||||
|
|
16
vfs/fish.c
16
vfs/fish.c
|
@ -619,16 +619,28 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
|
|||
g_free (name);
|
||||
name = quoted_name;
|
||||
fh->u.fish.append = 0;
|
||||
|
||||
/*
|
||||
* Check whether the remote file is readable by using `dd' to copy
|
||||
* a single byte from the remote file to /dev/null. If `dd' completes
|
||||
* with exit status of 0 use `cat' to send the file contents to the
|
||||
* standard output (i.e. over the network).
|
||||
*/
|
||||
offset = fish_command (me, FH_SUPER, WANT_STRING,
|
||||
"#RETR /%s\n"
|
||||
"if dd if=/%s of=/dev/null bs=1 count=1 2>/dev/null ;\n"
|
||||
"then\n"
|
||||
"ls -ln /%s 2>/dev/null | (\n"
|
||||
"read p l u g s r\n"
|
||||
"echo \"$s\"\n"
|
||||
")\n"
|
||||
"echo '### 100'\n"
|
||||
"cat /%s\n"
|
||||
"echo '### 200'\n",
|
||||
name, name, name );
|
||||
"echo '### 200'\n"
|
||||
"else\n"
|
||||
"echo '### 500'\n"
|
||||
"fi\n",
|
||||
name, name, name, name );
|
||||
g_free (name);
|
||||
if (offset != PRELIM) ERRNOR (E_REMOTE, 0);
|
||||
fh->linear = LS_LINEAR_OPEN;
|
||||
|
|
Loading…
Reference in New Issue