~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add an extra example to the Plink-with-WinCVS section.
[sgt/putty]
/
psftp.c
diff --git
a/psftp.c
b/psftp.c
index
302e1a7
..
094e68b
100644
(file)
--- a/
psftp.c
+++ b/
psftp.c
@@
-25,7
+25,7
@@
*/
static int psftp_connect(char *userhost, char *user, int portnumber);
*/
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.
/* ----------------------------------------------------------------------
* sftp client state.
@@
-1361,7
+1361,7
@@
struct sftp_command *sftp_getcmd(FILE *fp, int mode, int modeflags)
return cmd;
}
return cmd;
}
-static
void
do_sftp_init(void)
+static
int
do_sftp_init(void)
{
/*
* Do protocol initialisation.
{
/*
* Do protocol initialisation.
@@
-1369,7
+1369,7
@@
static void do_sftp_init(void)
if (!fxp_init()) {
fprintf(stderr,
"Fatal: unable to initialise SFTP: %s\n", fxp_error());
if (!fxp_init()) {
fprintf(stderr,
"Fatal: unable to initialise SFTP: %s\n", fxp_error());
- return
;
+ return
1; /* failure */
}
/*
}
/*
@@
-1385,6
+1385,7
@@
static void do_sftp_init(void)
printf("Remote working directory is %s\n", homedir);
}
pwd = dupstr(homedir);
printf("Remote working directory is %s\n", homedir);
}
pwd = dupstr(homedir);
+ return 0;
}
void do_sftp(int mode, int modeflags, char *batchfile)
}
void do_sftp(int mode, int modeflags, char *batchfile)
@@
-1511,6
+1512,8
@@
int from_backend(int is_stderr, char *data, int datalen)
unsigned char *p = (unsigned char *) data;
unsigned len = (unsigned) datalen;
unsigned char *p = (unsigned char *) data;
unsigned len = (unsigned) datalen;
+ assert(len > 0);
+
/*
* stderr data is just spouted to local stderr and otherwise
* ignored.
/*
* stderr data is just spouted to local stderr and otherwise
* ignored.
@@
-1847,7
+1850,8
@@
int main(int argc, char *argv[])
if (userhost) {
if (psftp_connect(userhost, user, portnumber))
return 1;
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");
} else {
printf("psftp: no hostname specified; use \"open host.name\""
" to connect\n");