mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Merge branch '3641_cleanup'
* 3641_cleanup: lib/mcconfig/paths.c: reduce scope of 'homedir' var. lib/mcconfig/paths.c: cleanup. doc/man/mc.1.in: fix substitution markers. src/vfs/fish/fish.c: apply coding guidelines. More use link_isdir(). Get rid of #define const_cast(). Fix typos. Define NCURSES_CONST if curses library doesn't define it. (ftpfs_open_data_connection): fix enable/disable interrupt key. (ftpfs_open_data_connection): fix socket leak in case of unsuccessful ftp connection. (dlg_adjust_position): refactoring. Ticket #3641: code cleanup before 4.8.18 release.
This commit is contained in:
commit
74dda7352e
@ -377,7 +377,7 @@ AC_ARG_WITH([homedir],
|
||||
if test x$with_homedir = xXDG; then
|
||||
AC_DEFINE(MC_HOMEDIR_XDG, 1, [Define to enable XDG standard support])
|
||||
else
|
||||
AC_DEFINE(MC_HOMEDIR_XDG, 0, [Define to disble XDG standard support])
|
||||
AC_DEFINE(MC_HOMEDIR_XDG, 0, [Define to disable XDG standard support])
|
||||
AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
|
||||
fi
|
||||
|
||||
|
@ -3691,7 +3691,7 @@ or without it). Search of skin\-file will occur in (to the first one found):
|
||||
.B ~/.local/share/mc/skins/
|
||||
.br
|
||||
2)
|
||||
.B @sysconfdir@/mc/skins/
|
||||
.B %sysconfdir%/mc/skins/
|
||||
.br
|
||||
3)
|
||||
.B %prefix%/share/mc/skins/
|
||||
|
@ -135,9 +135,6 @@
|
||||
/* one caused by typing 'exit' or 'logout' in the subshell */
|
||||
#define SUBSHELL_EXIT 128
|
||||
|
||||
/* C++ style type casts */
|
||||
#define const_cast(m_type, m_expr) ((m_type) (m_expr))
|
||||
|
||||
#if 0
|
||||
#ifdef MC_ENABLE_DEBUGGING_CODE
|
||||
#undef NDEBUG
|
||||
|
@ -51,7 +51,6 @@ static char *mc_config_str = NULL;
|
||||
static char *mc_cache_str = NULL;
|
||||
static char *mc_data_str = NULL;
|
||||
|
||||
static const char *homedir = NULL;
|
||||
/* value of $MC_HOME */
|
||||
static const char *mc_home = NULL;
|
||||
|
||||
@ -289,8 +288,6 @@ mc_config_init_config_paths (GError ** mcerror)
|
||||
char *dir;
|
||||
#if MC_HOMEDIR_XDG == 0
|
||||
char *defined_userconf_dir;
|
||||
#else
|
||||
const char *cdir;
|
||||
#endif
|
||||
|
||||
mc_return_if_error (mcerror);
|
||||
@ -298,7 +295,7 @@ mc_config_init_config_paths (GError ** mcerror)
|
||||
if (xdg_vars_initialized)
|
||||
return;
|
||||
|
||||
/* init mc_home and homedir if not yet */
|
||||
/* init mc_home if not yet */
|
||||
(void) mc_config_get_home_dir ();
|
||||
|
||||
#if MC_HOMEDIR_XDG
|
||||
@ -318,35 +315,12 @@ mc_config_init_config_paths (GError ** mcerror)
|
||||
}
|
||||
else
|
||||
{
|
||||
cdir = g_get_user_config_dir ();
|
||||
if (cdir != NULL && *cdir != '\0')
|
||||
mc_config_str = mc_config_init_one_config_path (cdir, MC_USERCONF_DIR, mcerror);
|
||||
else
|
||||
{
|
||||
dir = g_build_filename (homedir, ".config", (char *) NULL);
|
||||
mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, mcerror);
|
||||
g_free (dir);
|
||||
}
|
||||
|
||||
cdir = g_get_user_cache_dir ();
|
||||
if (cdir != NULL && *cdir != '\0')
|
||||
mc_cache_str = mc_config_init_one_config_path (cdir, MC_USERCONF_DIR, mcerror);
|
||||
else
|
||||
{
|
||||
dir = g_build_filename (homedir, ".cache", (char *) NULL);
|
||||
mc_cache_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, mcerror);
|
||||
g_free (dir);
|
||||
}
|
||||
|
||||
cdir = g_get_user_data_dir ();
|
||||
if (cdir != NULL && *cdir != '\0')
|
||||
mc_data_str = mc_config_init_one_config_path (cdir, MC_USERCONF_DIR, mcerror);
|
||||
else
|
||||
{
|
||||
dir = g_build_filename (homedir, ".local", "share", (char *) NULL);
|
||||
mc_data_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, mcerror);
|
||||
g_free (dir);
|
||||
}
|
||||
mc_config_str =
|
||||
mc_config_init_one_config_path (g_get_user_config_dir (), MC_USERCONF_DIR, mcerror);
|
||||
mc_cache_str =
|
||||
mc_config_init_one_config_path (g_get_user_cache_dir (), MC_USERCONF_DIR, mcerror);
|
||||
mc_data_str =
|
||||
mc_config_init_one_config_path (g_get_user_data_dir (), MC_USERCONF_DIR, mcerror);
|
||||
}
|
||||
|
||||
mc_config_fix_migrated_rules ();
|
||||
@ -415,9 +389,15 @@ mc_config_get_cache_path (void)
|
||||
const char *
|
||||
mc_config_get_home_dir (void)
|
||||
{
|
||||
static const char *homedir = NULL;
|
||||
|
||||
if (homedir == NULL)
|
||||
{
|
||||
homedir = g_getenv ("MC_HOME");
|
||||
/* Prior to GLib 2.36, g_get_home_dir() ignores $HOME, which is why
|
||||
* we read it ourselves. As that function's documentation explains,
|
||||
* using $HOME is good for compatibility with other programs and
|
||||
* for running from test frameworks. */
|
||||
if (homedir == NULL || *homedir == '\0')
|
||||
homedir = g_getenv ("HOME");
|
||||
else
|
||||
|
@ -80,7 +80,7 @@
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/* ncurses supports cursor positions only within window */
|
||||
/* We use our own cursor coordibates to support partially visible widgets */
|
||||
/* We use our own cursor coordinates to support partially visible widgets */
|
||||
static int mc_curs_row, mc_curs_col;
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include <ncursesw/curses.h>
|
||||
#endif /* USE_NCURSESW */
|
||||
|
||||
/* netbsd-libcurses doesn't define NCURSES_CONST */
|
||||
#ifndef NCURSES_CONST
|
||||
#define NCURSES_CONST const
|
||||
#endif
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
@ -686,11 +686,9 @@ dlg_widget_set_position (gpointer data, gpointer user_data)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
dlg_adjust_position (const WDialog * h, int *y, int *x, int *lines, int *cols)
|
||||
dlg_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols)
|
||||
{
|
||||
const Widget *w = CONST_WIDGET (h);
|
||||
|
||||
if ((w->pos_flags & WPOS_FULLSCREEN) != 0)
|
||||
if ((pos_flags & WPOS_FULLSCREEN) != 0)
|
||||
{
|
||||
*y = 0;
|
||||
*x = 0;
|
||||
@ -699,17 +697,13 @@ dlg_adjust_position (const WDialog * h, int *y, int *x, int *lines, int *cols)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((w->pos_flags & WPOS_CENTER_HORZ) != 0)
|
||||
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
|
||||
*x = (COLS - *cols) / 2;
|
||||
else
|
||||
*x = w->x;
|
||||
|
||||
if ((w->pos_flags & WPOS_CENTER_VERT) != 0)
|
||||
if ((pos_flags & WPOS_CENTER_VERT) != 0)
|
||||
*y = (LINES - *lines) / 2;
|
||||
else
|
||||
*y = w->y;
|
||||
|
||||
if ((w->pos_flags & WPOS_TRYUP) != 0)
|
||||
if ((pos_flags & WPOS_TRYUP) != 0)
|
||||
{
|
||||
if (*y > 3)
|
||||
*y -= 2;
|
||||
@ -796,7 +790,7 @@ dlg_set_size (WDialog * h, int lines, int cols)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
|
||||
dlg_adjust_position (h, &y, &x, &lines, &cols);
|
||||
dlg_adjust_position (WIDGET (h)->pos_flags, &y, &x, &lines, &cols);
|
||||
dlg_set_position (h, y, x, lines, cols);
|
||||
}
|
||||
|
||||
@ -855,11 +849,10 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flag
|
||||
|
||||
new_d = g_new0 (WDialog, 1);
|
||||
w = WIDGET (new_d);
|
||||
w->pos_flags = pos_flags; /* required for dlg_adjust_position() */
|
||||
dlg_adjust_position (new_d, &y1, &x1, &lines, &cols);
|
||||
dlg_adjust_position (pos_flags, &y1, &x1, &lines, &cols);
|
||||
widget_init (w, y1, x1, lines, cols, (callback != NULL) ? callback : dlg_default_callback,
|
||||
mouse_callback);
|
||||
w->pos_flags = pos_flags; /* restore after widget_init() */
|
||||
w->pos_flags = pos_flags;
|
||||
w->options |= WOP_TOP_SELECT;
|
||||
|
||||
w->state |= WST_CONSTRUCT;
|
||||
|
@ -55,9 +55,9 @@
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
#define MY_ISDIR(x) (\
|
||||
(is_exe (x->st.st_mode) && !(S_ISDIR (x->st.st_mode) || x->f.link_to_dir) && exec_first) \
|
||||
(is_exe (x->st.st_mode) && !(S_ISDIR (x->st.st_mode) || link_isdir (x)) && exec_first) \
|
||||
? 1 \
|
||||
: ( (S_ISDIR (x->st.st_mode) || x->f.link_to_dir) ? 2 : 0) )
|
||||
: ( (S_ISDIR (x->st.st_mode) || link_isdir (x)) ? 2 : 0) )
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
|
@ -526,10 +526,10 @@ string_file_size (file_entry_t * fe, int len)
|
||||
static const char *
|
||||
string_file_size_brief (file_entry_t * fe, int len)
|
||||
{
|
||||
if (S_ISLNK (fe->st.st_mode) && !fe->f.link_to_dir)
|
||||
if (S_ISLNK (fe->st.st_mode) && !link_isdir (fe))
|
||||
return _("SYMLINK");
|
||||
|
||||
if ((S_ISDIR (fe->st.st_mode) || fe->f.link_to_dir) && !DIR_IS_DOTDOT (fe->fname))
|
||||
if ((S_ISDIR (fe->st.st_mode) || link_isdir (fe)) && !DIR_IS_DOTDOT (fe->fname))
|
||||
return _("SUB-DIR");
|
||||
|
||||
return string_file_size (fe, len);
|
||||
@ -549,7 +549,7 @@ string_file_type (file_entry_t * fe, int len)
|
||||
buffer[0] = PATH_SEP;
|
||||
else if (S_ISLNK (fe->st.st_mode))
|
||||
{
|
||||
if (fe->f.link_to_dir)
|
||||
if (link_isdir (fe))
|
||||
buffer[0] = '~';
|
||||
else if (fe->f.stale_link)
|
||||
buffer[0] = '!';
|
||||
@ -2877,7 +2877,7 @@ chdir_other_panel (WPanel * panel)
|
||||
if (get_other_type () != view_listing)
|
||||
set_display_type (get_other_index (), view_listing);
|
||||
|
||||
if (S_ISDIR (entry->st.st_mode) || entry->f.link_to_dir)
|
||||
if (S_ISDIR (entry->st.st_mode) || link_isdir (entry))
|
||||
new_dir_vpath = vfs_path_append_new (panel->cwd_vpath, entry->fname, (char *) NULL);
|
||||
else
|
||||
{
|
||||
|
@ -245,24 +245,23 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
|
||||
FILE *logfile = MEDATA->logfile;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
str = g_strdup_vprintf (fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
if (logfile)
|
||||
if (logfile != NULL)
|
||||
{
|
||||
size_t ret;
|
||||
|
||||
ret = fwrite (str, strlen (str), 1, logfile);
|
||||
ret = fflush (logfile);
|
||||
(void) ret;
|
||||
}
|
||||
|
||||
tty_enable_interrupt_key ();
|
||||
|
||||
status = write (SUP->sockw, str, strlen (str));
|
||||
g_free (str);
|
||||
|
||||
tty_disable_interrupt_key ();
|
||||
|
||||
if (status < 0)
|
||||
return TRANSIENT;
|
||||
|
||||
@ -340,7 +339,7 @@ fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
|
||||
res = open ("/dev/null", O_WRONLY);
|
||||
close (fileset2[0]);
|
||||
close (fileset2[1]);
|
||||
execvp (path, const_cast (char **, argv));
|
||||
execvp (path, (char **) argv);
|
||||
my_exit (3);
|
||||
}
|
||||
}
|
||||
@ -403,7 +402,6 @@ fish_info (struct vfs_class *me, struct vfs_s_super *super)
|
||||
ERRNOR (E_PROTO, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
@ -459,7 +457,7 @@ fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
|
||||
|
||||
printf ("\n%s\n", _("fish: Waiting for initial line..."));
|
||||
|
||||
if (!vfs_s_get_line (me, SUP->sockr, answer, sizeof (answer), ':'))
|
||||
if (vfs_s_get_line (me, SUP->sockr, answer, sizeof (answer), ':') == 0)
|
||||
return FALSE;
|
||||
|
||||
if (strstr (answer, "assword") != NULL)
|
||||
@ -474,13 +472,13 @@ fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
|
||||
if (super->path_element->password == NULL)
|
||||
{
|
||||
char *p, *op;
|
||||
|
||||
p = g_strdup_printf (_("fish: Password is required for %s"), super->path_element->user);
|
||||
op = vfs_get_password (p);
|
||||
g_free (p);
|
||||
if (op == NULL)
|
||||
return FALSE;
|
||||
super->path_element->password = op;
|
||||
|
||||
}
|
||||
|
||||
printf ("\n%s\n", _("fish: Sending password..."));
|
||||
@ -504,6 +502,7 @@ static int
|
||||
fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
gboolean ftalk;
|
||||
|
||||
/* hide panels */
|
||||
pre_exec ();
|
||||
|
||||
@ -658,10 +657,8 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
* Simple FISH debug interface :]
|
||||
*/
|
||||
#if 0
|
||||
if (!(MEDATA->logfile))
|
||||
{
|
||||
if (MEDATA->logfile == NULL)
|
||||
MEDATA->logfile = fopen ("/tmp/mc-FISH.sh", "w");
|
||||
}
|
||||
#endif
|
||||
logfile = MEDATA->logfile;
|
||||
|
||||
@ -675,6 +672,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
g_free (shell_commands);
|
||||
g_free (quoted_path);
|
||||
ent = vfs_s_generate_entry (me, NULL, dir, 0);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
int res;
|
||||
@ -687,17 +685,17 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
me->verrno = ECONNRESET;
|
||||
goto error;
|
||||
}
|
||||
if (logfile)
|
||||
if (logfile != NULL)
|
||||
{
|
||||
fputs (buffer, logfile);
|
||||
fputs ("\n", logfile);
|
||||
fflush (logfile);
|
||||
}
|
||||
if (!strncmp (buffer, "### ", 4))
|
||||
if (strncmp (buffer, "### ", 4) == 0)
|
||||
break;
|
||||
if ((!buffer[0]))
|
||||
if (buffer[0] == '\0')
|
||||
{
|
||||
if (ent->name)
|
||||
if (ent->name != NULL)
|
||||
{
|
||||
vfs_s_insert_entry (me, dir, ent);
|
||||
ent = vfs_s_generate_entry (me, NULL, dir, 0);
|
||||
@ -718,7 +716,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
|
||||
filename_bound = filename + strlen (filename);
|
||||
|
||||
if (!strcmp (data_start, "\".\"") || !strcmp (data_start, "\"..\""))
|
||||
if (strcmp (data_start, "\".\"") == 0 || strcmp (data_start, "\"..\"") == 0)
|
||||
break; /* We'll do "." and ".." ourselves */
|
||||
|
||||
if (S_ISLNK (ST.st_mode))
|
||||
@ -736,7 +734,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
++filename;
|
||||
|
||||
linkname = strstr (filename, "\" -> \"");
|
||||
if (!linkname)
|
||||
if (linkname == NULL)
|
||||
{
|
||||
/* broken client, or smth goes wrong */
|
||||
linkname = filename_bound;
|
||||
@ -788,6 +786,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
case 'P':
|
||||
{
|
||||
size_t skipped;
|
||||
|
||||
vfs_parse_filemode (buffer + 1, &skipped, &ST.st_mode);
|
||||
break;
|
||||
}
|
||||
@ -798,13 +797,14 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
we expect: Roctal-filemode octal-filetype uid.gid
|
||||
*/
|
||||
size_t skipped;
|
||||
|
||||
vfs_parse_raw_filemode (buffer + 1, &skipped, &ST.st_mode);
|
||||
break;
|
||||
}
|
||||
case 'd':
|
||||
{
|
||||
vfs_split_text (buffer + 1);
|
||||
if (!vfs_parse_filedate (0, &ST.st_ctime))
|
||||
if (vfs_parse_filedate (0, &ST.st_ctime) == 0)
|
||||
break;
|
||||
ST.st_atime = ST.st_mtime = ST.st_ctime;
|
||||
}
|
||||
@ -812,6 +812,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
case 'D':
|
||||
{
|
||||
struct tm tim;
|
||||
|
||||
/* cppcheck-suppress invalidscanf */
|
||||
if (sscanf (buffer + 1, "%d %d %d %d %d %d", &tim.tm_year, &tim.tm_mon,
|
||||
&tim.tm_mday, &tim.tm_hour, &tim.tm_min, &tim.tm_sec) != 6)
|
||||
@ -822,6 +823,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
case 'E':
|
||||
{
|
||||
int maj, min;
|
||||
|
||||
/* cppcheck-suppress invalidscanf */
|
||||
if (sscanf (buffer + 1, "%d,%d", &maj, &min) != 2)
|
||||
break;
|
||||
@ -1105,7 +1107,9 @@ fish_ctl (void *fh, int ctlop, void *arg)
|
||||
(void) arg;
|
||||
(void) fh;
|
||||
(void) ctlop;
|
||||
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
switch (ctlop)
|
||||
{
|
||||
@ -1113,15 +1117,14 @@ fish_ctl (void *fh, int ctlop, void *arg)
|
||||
{
|
||||
int v;
|
||||
|
||||
if (!FH->linear)
|
||||
if (FH->linear == 0)
|
||||
vfs_die ("You may not do this");
|
||||
if (FH->linear == LS_LINEAR_CLOSED || FH->linear == LS_LINEAR_PREOPEN)
|
||||
return 0;
|
||||
|
||||
v = vfs_s_select_on_two (FH_SUPER->u.fish.sockr, 0);
|
||||
if (((v < 0) && (errno == EINTR)) || v == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
return (((v < 0) && (errno == EINTR)) || v == 0) ? 1 : 0;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
@ -1140,7 +1143,7 @@ fish_send_command (struct vfs_class *me, struct vfs_s_super *super, const char *
|
||||
vfs_stamp_create (&vfs_fish_ops, super);
|
||||
if (r != COMPLETE)
|
||||
ERRNOR (E_REMOTE, -1);
|
||||
if (flags & OPT_FLUSH)
|
||||
if ((flags & OPT_FLUSH) != 0)
|
||||
vfs_s_invalidate (me, super);
|
||||
return 0;
|
||||
}
|
||||
@ -1326,7 +1329,6 @@ fish_utime (const vfs_path_t * vpath, struct utimbuf *times)
|
||||
gchar *shell_commands = NULL;
|
||||
char utcmtime[16], utcatime[16];
|
||||
struct tm *gmt;
|
||||
|
||||
char buf[BUF_LARGE];
|
||||
const char *crpath;
|
||||
char *rpath;
|
||||
@ -1366,7 +1368,6 @@ static int
|
||||
fish_unlink (const vfs_path_t * vpath)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
|
||||
char buf[BUF_LARGE];
|
||||
const char *crpath;
|
||||
char *rpath;
|
||||
@ -1394,7 +1395,6 @@ static int
|
||||
fish_exists (const vfs_path_t * vpath)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
|
||||
char buf[BUF_LARGE];
|
||||
const char *crpath;
|
||||
char *rpath;
|
||||
@ -1450,7 +1450,7 @@ fish_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||
if (ret_code != 0)
|
||||
return ret_code;
|
||||
|
||||
if (!fish_exists (vpath))
|
||||
if (fish_exists (vpath) == 0)
|
||||
{
|
||||
path_element->class->verrno = EACCES;
|
||||
return -1;
|
||||
@ -1513,7 +1513,7 @@ fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t m
|
||||
if ((flags & O_APPEND) != 0)
|
||||
fish->append = TRUE;
|
||||
|
||||
if (!fh->ino->localname)
|
||||
if (fh->ino->localname == NULL)
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
int tmp_handle;
|
||||
@ -1530,9 +1530,9 @@ fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t m
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!fh->ino->localname && vfs_s_retrieve_file (me, fh->ino) == -1)
|
||||
if (fh->ino->localname == NULL && vfs_s_retrieve_file (me, fh->ino) == -1)
|
||||
goto fail;
|
||||
if (!fh->ino->localname)
|
||||
if (fh->ino->localname == NULL)
|
||||
vfs_die ("retrieve_file failed to fill in localname");
|
||||
return 0;
|
||||
|
||||
|
@ -1370,13 +1370,21 @@ ftpfs_open_data_connection (struct vfs_class *me, struct vfs_s_super *super, con
|
||||
return -1;
|
||||
|
||||
if (ftpfs_changetype (me, super, isbinary) == -1)
|
||||
{
|
||||
close (s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (reget > 0)
|
||||
{
|
||||
j = ftpfs_command (me, super, WAIT_REPLY, "REST %d", reget);
|
||||
if (j != CONTINUE)
|
||||
{
|
||||
close (s);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (remote)
|
||||
{
|
||||
char *remote_path = ftpfs_translate_path (me, super, remote);
|
||||
@ -1389,22 +1397,24 @@ ftpfs_open_data_connection (struct vfs_class *me, struct vfs_s_super *super, con
|
||||
j = ftpfs_command (me, super, WAIT_REPLY, "%s", cmd);
|
||||
|
||||
if (j != PRELIM)
|
||||
{
|
||||
close (s);
|
||||
ERRNOR (EPERM, -1);
|
||||
tty_enable_interrupt_key ();
|
||||
}
|
||||
|
||||
if (SUP->use_passive_connection)
|
||||
data = s;
|
||||
else
|
||||
{
|
||||
tty_enable_interrupt_key ();
|
||||
data = accept (s, (struct sockaddr *) &from, &fromlen);
|
||||
if (data < 0)
|
||||
{
|
||||
ftpfs_errno = errno;
|
||||
close (s);
|
||||
return -1;
|
||||
}
|
||||
tty_disable_interrupt_key ();
|
||||
close (s);
|
||||
if (data < 0)
|
||||
return -1;
|
||||
}
|
||||
tty_disable_interrupt_key ();
|
||||
SUP->ctl_connection_busy = 1;
|
||||
return data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user