mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* vfs/fish.c (fish_dir_load): Check the exit status of the remote command
and fail with EACCES if it was unsuccessful. Fix the value returned on error - must be -1 instead of 1.
This commit is contained in:
parent
7c190bc576
commit
d2fb34f021
@ -1,3 +1,9 @@
|
|||||||
|
2007-11-02 Pavel Tsekov <ptsekov@gmx.net>
|
||||||
|
|
||||||
|
* fish.c (fish_dir_load): Check the exit status of the remote command
|
||||||
|
and fail with EACCES if it was unsuccessful.
|
||||||
|
Fix the value returned on error - must be -1 instead of 1.
|
||||||
|
|
||||||
2007-11-02 Vladimir Nadvornik <nadvornik@suse.cz>
|
2007-11-02 Vladimir Nadvornik <nadvornik@suse.cz>
|
||||||
|
|
||||||
* smbfs.c (smbfs_convert_path): Replaced NULL with (char *) NULL.
|
* smbfs.c (smbfs_convert_path): Replaced NULL with (char *) NULL.
|
||||||
|
20
vfs/fish.c
20
vfs/fish.c
@ -356,6 +356,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
struct vfs_s_entry *ent = NULL;
|
struct vfs_s_entry *ent = NULL;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
char *quoted_path;
|
char *quoted_path;
|
||||||
|
int reply_code;
|
||||||
|
|
||||||
logfile = MEDATA->logfile;
|
logfile = MEDATA->logfile;
|
||||||
|
|
||||||
@ -366,6 +367,8 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
quoted_path = name_quote (remote_path, 0);
|
quoted_path = name_quote (remote_path, 0);
|
||||||
fish_command (me, super, NONE,
|
fish_command (me, super, NONE,
|
||||||
"#LIST /%s\n"
|
"#LIST /%s\n"
|
||||||
|
"if ls -1 /%s >/dev/null 2>&1 ;\n"
|
||||||
|
"then\n"
|
||||||
"ls -lLan /%s 2>/dev/null | grep '^[^cbt]' | (\n"
|
"ls -lLan /%s 2>/dev/null | grep '^[^cbt]' | (\n"
|
||||||
"while read p l u g s m d y n; do\n"
|
"while read p l u g s m d y n; do\n"
|
||||||
"echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
|
"echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
|
||||||
@ -376,8 +379,11 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
"echo \"P$p $u.$g\nE$a$i\nd$m $d $y\n:$n\n\"\n"
|
"echo \"P$p $u.$g\nE$a$i\nd$m $d $y\n:$n\n\"\n"
|
||||||
"done\n"
|
"done\n"
|
||||||
")\n"
|
")\n"
|
||||||
"echo '### 200'\n",
|
"echo '### 200'\n"
|
||||||
remote_path, quoted_path, quoted_path);
|
"else\n"
|
||||||
|
"echo '### 500'\n"
|
||||||
|
"fi\n",
|
||||||
|
remote_path, quoted_path, quoted_path, quoted_path);
|
||||||
g_free (quoted_path);
|
g_free (quoted_path);
|
||||||
ent = vfs_s_generate_entry(me, NULL, dir, 0);
|
ent = vfs_s_generate_entry(me, NULL, dir, 0);
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -456,17 +462,21 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfs_s_free_entry (me, ent);
|
vfs_s_free_entry (me, ent);
|
||||||
me->verrno = E_REMOTE;
|
reply_code = fish_decode_reply(buffer + 4, 0);
|
||||||
if (fish_decode_reply(buffer+4, 0) == COMPLETE) {
|
if (reply_code == COMPLETE) {
|
||||||
g_free (SUP.cwdir);
|
g_free (SUP.cwdir);
|
||||||
SUP.cwdir = g_strdup (remote_path);
|
SUP.cwdir = g_strdup (remote_path);
|
||||||
print_vfs_message (_("%s: done."), me->name);
|
print_vfs_message (_("%s: done."), me->name);
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (reply_code == ERROR) {
|
||||||
|
me->verrno = EACCES;
|
||||||
|
} else {
|
||||||
|
me->verrno = E_REMOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
print_vfs_message (_("%s: failure"), me->name);
|
print_vfs_message (_("%s: failure"), me->name);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user