if (fxp_error_type() == SSH_FX_EOF)
break;
printf("%s: reading directory: %s\n", fname, fxp_error());
if (fxp_error_type() == SSH_FX_EOF)
break;
printf("%s: reading directory: %s\n", fname, fxp_error());
- qsort(ournames, nnames, sizeof(*ournames), sftp_name_compare);
+ if (nnames > 0)
+ qsort(ournames, nnames, sizeof(*ournames), sftp_name_compare);
- if (outfname)
- nextoutfname = dir_file_cat(outfname,
- ournames[i]->filename);
- else
- nextoutfname = dupstr(ournames[i]->filename);
+ nextoutfname = dir_file_cat(outfname,
+ ournames[i]->filename);
int ret;
nextfname = dupcat(fname, "/", ournames[i]->filename, NULL);
int ret;
nextfname = dupcat(fname, "/", ournames[i]->filename, NULL);
- if (outfname)
- nextoutfname = dir_file_cat(outfname,
- ournames[i]->filename);
- else
- nextoutfname = dupstr(ournames[i]->filename);
+ nextoutfname = dir_file_cat(outfname, ournames[i]->filename);
ret = sftp_get_file(nextfname, nextoutfname, recurse, restart);
restart = FALSE; /* after first partial file, do full */
sfree(nextoutfname);
ret = sftp_get_file(nextfname, nextoutfname, recurse, restart);
restart = FALSE; /* after first partial file, do full */
sfree(nextoutfname);
* same directory, just in case two readdirs on the same
* local directory return a different order.
*/
* same directory, just in case two readdirs on the same
* local directory return a different order.
*/
- qsort(ournames, nnames, sizeof(*ournames), bare_name_compare);
+ if (nnames > 0)
+ qsort(ournames, nnames, sizeof(*ournames), bare_name_compare);
nextoutfname = dupcat(outfname, "/", ournames[i], NULL);
ret = sftp_put_file(nextfname, nextoutfname, recurse, restart);
restart = FALSE; /* after first partial file, do full */
nextoutfname = dupcat(outfname, "/", ournames[i], NULL);
ret = sftp_put_file(nextfname, nextoutfname, recurse, restart);
restart = FALSE; /* after first partial file, do full */
- if (ret <= 0 && !err) {
- printf("error while writing: %s\n", fxp_error());
- err = 1;
+ if (ret <= 0) {
+ if (ret == INT_MIN) /* pktin not even freed */
+ sfree(pktin);
+ if (!err) {
+ printf("error while writing: %s\n", fxp_error());
+ err = 1;
+ }
* Now we have our filenames. Sort them by actual file
* name, and then output the longname parts.
*/
* Now we have our filenames. Sort them by actual file
* name, and then output the longname parts.
*/
- qsort(ournames, nnames, sizeof(*ournames), sftp_name_compare);
+ if (nnames > 0)
+ qsort(ournames, nnames, sizeof(*ournames), sftp_name_compare);
+void nonfatal(char *fmt, ...)
+{
+ char *str, *str2;
+ va_list ap;
+ va_start(ap, fmt);
+ str = dupvprintf(fmt, ap);
+ str2 = dupcat("Error: ", str, "\n", NULL);
+ sfree(str);
+ va_end(ap);
+ fputs(str2, stderr);
+ sfree(str2);
+}
printf(" -1 -2 force use of particular SSH protocol version\n");
printf(" -4 -6 force use of IPv4 or IPv6\n");
printf(" -C enable compression\n");
printf(" -1 -2 force use of particular SSH protocol version\n");
printf(" -4 -6 force use of IPv4 or IPv6\n");
printf(" -C enable compression\n");
/* Use `host' as a bare hostname. */
conf_set_str(conf, CONF_host, host);
}
/* Use `host' as a bare hostname. */
conf_set_str(conf, CONF_host, host);
}
} else {
/* Patch in hostname `host' to session details. */
conf_set_str(conf, CONF_host, host);
} else {
/* Patch in hostname `host' to session details. */
conf_set_str(conf, CONF_host, host);