*/
static int psftp_connect(char *userhost, char *user, int portnumber);
-static void do_sftp_init(void);
+static int do_sftp_init(void);
/* ----------------------------------------------------------------------
* sftp client state.
return cmd;
}
-static void do_sftp_init(void)
+static int do_sftp_init(void)
{
/*
* Do protocol initialisation.
if (!fxp_init()) {
fprintf(stderr,
"Fatal: unable to initialise SFTP: %s\n", fxp_error());
- return;
+ return 1; /* failure */
}
/*
printf("Remote working directory is %s\n", homedir);
}
pwd = dupstr(homedir);
+ return 0;
}
void do_sftp(int mode, int modeflags, char *batchfile)
unsigned char *p = (unsigned char *) data;
unsigned len = (unsigned) datalen;
+ assert(len > 0);
+
/*
* stderr data is just spouted to local stderr and otherwise
* ignored.
if (userhost) {
if (psftp_connect(userhost, user, portnumber))
return 1;
- do_sftp_init();
+ if (do_sftp_init())
+ return 1;
} else {
printf("psftp: no hostname specified; use \"open host.name\""
" to connect\n");