mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Give fxp_mkdir_send an attrs parameter.
It's not used anywhere, but this would make it one step easier to add a mode argument to PSFTP's mkdir command, if anyone needs it. Mostly the point is to get rid of the FIXME comment in fxp_mkdir_send itself.
This commit is contained in:
parent
d9369d4a46
commit
6c0f22bb9f
2
pscp.c
2
pscp.c
@ -1015,7 +1015,7 @@ int scp_send_dirname(const char *name, int modes)
|
||||
* exists and is a directory we will assume we were either
|
||||
* successful or it didn't matter.
|
||||
*/
|
||||
req = fxp_mkdir_send(fullname);
|
||||
req = fxp_mkdir_send(fullname, NULL);
|
||||
pktin = sftp_wait_for_reply(req);
|
||||
ret = fxp_mkdir_recv(pktin, req);
|
||||
|
||||
|
4
psftp.c
4
psftp.c
@ -516,7 +516,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
|
||||
if (!result ||
|
||||
!(attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) ||
|
||||
!(attrs.permissions & 0040000)) {
|
||||
req = fxp_mkdir_send(outfname);
|
||||
req = fxp_mkdir_send(outfname, NULL);
|
||||
pktin = sftp_wait_for_reply(req);
|
||||
result = fxp_mkdir_recv(pktin, req);
|
||||
|
||||
@ -1422,7 +1422,7 @@ int sftp_cmd_mkdir(struct sftp_command *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
req = fxp_mkdir_send(dir);
|
||||
req = fxp_mkdir_send(dir, NULL);
|
||||
pktin = sftp_wait_for_reply(req);
|
||||
result = fxp_mkdir_recv(pktin, req);
|
||||
|
||||
|
14
sftp.c
14
sftp.c
@ -85,6 +85,8 @@ static void BinarySink_put_fxp_attrs(BinarySink *bs, struct fxp_attrs attrs)
|
||||
}
|
||||
}
|
||||
|
||||
static const struct fxp_attrs no_attrs = { 0 };
|
||||
|
||||
#define put_fxp_attrs(bs, attrs) \
|
||||
BinarySink_put_fxp_attrs(BinarySink_UPCAST(bs), attrs)
|
||||
|
||||
@ -460,7 +462,7 @@ char *fxp_realpath_recv(struct sftp_packet *pktin, struct sftp_request *req)
|
||||
* Open a file.
|
||||
*/
|
||||
struct sftp_request *fxp_open_send(const char *path, int type,
|
||||
struct fxp_attrs *attrs)
|
||||
const struct fxp_attrs *attrs)
|
||||
{
|
||||
struct sftp_request *req = sftp_alloc_request();
|
||||
struct sftp_packet *pktout;
|
||||
@ -469,10 +471,7 @@ struct sftp_request *fxp_open_send(const char *path, int type,
|
||||
put_uint32(pktout, req->id);
|
||||
put_stringz(pktout, path);
|
||||
put_uint32(pktout, type);
|
||||
if (attrs)
|
||||
put_fxp_attrs(pktout, *attrs);
|
||||
else
|
||||
put_uint32(pktout, 0); /* empty ATTRS structure */
|
||||
put_fxp_attrs(pktout, attrs ? *attrs : no_attrs);
|
||||
sftp_send(pktout);
|
||||
|
||||
return req;
|
||||
@ -566,7 +565,8 @@ int fxp_close_recv(struct sftp_packet *pktin, struct sftp_request *req)
|
||||
return fxp_errtype == SSH_FX_OK;
|
||||
}
|
||||
|
||||
struct sftp_request *fxp_mkdir_send(const char *path)
|
||||
struct sftp_request *fxp_mkdir_send(const char *path,
|
||||
const struct fxp_attrs *attrs)
|
||||
{
|
||||
struct sftp_request *req = sftp_alloc_request();
|
||||
struct sftp_packet *pktout;
|
||||
@ -574,7 +574,7 @@ struct sftp_request *fxp_mkdir_send(const char *path)
|
||||
pktout = sftp_pkt_init(SSH_FXP_MKDIR);
|
||||
put_uint32(pktout, req->id);
|
||||
put_stringz(pktout, path);
|
||||
put_uint32(pktout, 0); /* (FIXME) empty ATTRS structure */
|
||||
put_fxp_attrs(pktout, attrs ? *attrs : no_attrs);
|
||||
sftp_send(pktout);
|
||||
|
||||
return req;
|
||||
|
5
sftp.h
5
sftp.h
@ -138,7 +138,7 @@ char *fxp_realpath_recv(struct sftp_packet *pktin, struct sftp_request *req);
|
||||
* if it's being created.
|
||||
*/
|
||||
struct sftp_request *fxp_open_send(const char *path, int type,
|
||||
struct fxp_attrs *attrs);
|
||||
const struct fxp_attrs *attrs);
|
||||
struct fxp_handle *fxp_open_recv(struct sftp_packet *pktin,
|
||||
struct sftp_request *req);
|
||||
|
||||
@ -158,7 +158,8 @@ int fxp_close_recv(struct sftp_packet *pktin, struct sftp_request *req);
|
||||
/*
|
||||
* Make a directory.
|
||||
*/
|
||||
struct sftp_request *fxp_mkdir_send(const char *path);
|
||||
struct sftp_request *fxp_mkdir_send(const char *path,
|
||||
const struct fxp_attrs *attrs);
|
||||
int fxp_mkdir_recv(struct sftp_packet *pktin, struct sftp_request *req);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user