if (fxp_error_type() == SSH_FX_EOF)
break;
printf("%s: reading directory: %s\n", fname, fxp_error());
+
+ req = fxp_close_send(dirhandle);
+ pktin = sftp_wait_for_reply(req);
+ fxp_close_recv(pktin, req);
+
sfree(ournames);
return 0;
}
* readdirs on the same remote directory return a
* different order.
*/
- qsort(ournames, nnames, sizeof(*ournames), sftp_name_compare);
+ if (nnames > 0)
+ qsort(ournames, nnames, sizeof(*ournames), sftp_name_compare);
/*
* If we're in restart mode, find the last filename on
printf("error while reading: %s\n", fxp_error());
shown_err = TRUE;
}
+ if (ret == INT_MIN) /* pktin not even freed */
+ sfree(pktin);
ret = 0;
}
* 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);
/*
* If we're in restart mode, find the last filename on this
if (!xfer_done(xfer)) {
pktin = sftp_recv();
ret = xfer_upload_gotpkt(xfer, pktin);
- 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;
+ }
}
}
}
printf("%s: canonify: %s\n", newname, fxp_error());
ret = 0;
}
+ sfree(newname);
matched = TRUE;
ret &= func(ctx, cname);
sfree(cname);
char *tmpdir;
int len, check;
+ sfree(unwcdir);
wildcard = stripslashes(dir, 0);
unwcdir = dupstr(dir);
len = wildcard - dir;
* 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);
/*
* And print them.
fname = canonify(origwfname);
if (!fname) {
+ sftp_finish_wildcard_matching(swcm);
printf("%s: canonify: %s\n", origwfname, fxp_error());
+ sfree(origwfname);
sfree(unwcfname);
return 0;
}
cmd->obey = sftp_cmd_quit;
if ((mode == 0) || (modeflags & 1))
printf("quit\n");
+ sfree(line);
return cmd; /* eof */
}
cleanup_exit(1);
}
+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);
+}
void connection_fatal(void *frontend, char *fmt, ...)
{
char *str, *str2;
/* Use `host' as a bare hostname. */
conf_set_str(conf, CONF_host, host);
}
+ conf_free(conf2);
} else {
/* Patch in hostname `host' to session details. */
conf_set_str(conf, CONF_host, host);