=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sftp-client.c,v retrieving revision 1.101.2.1 retrieving revision 1.102 diff -u -r1.101.2.1 -r1.102 --- src/usr.bin/ssh/sftp-client.c 2013/11/08 01:33:56 1.101.2.1 +++ src/usr.bin/ssh/sftp-client.c 2013/08/08 05:04:03 1.102 @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.c,v 1.101.2.1 2013/11/08 01:33:56 djm Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.102 2013/08/08 05:04:03 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -464,7 +464,7 @@ if (dir) { ents = 0; - *dir = xcalloc(1, sizeof(**dir)); + *dir = xmalloc(sizeof(**dir)); (*dir)[0] = NULL; } @@ -538,7 +538,7 @@ if (dir) { *dir = xrealloc(*dir, ents + 2, sizeof(**dir)); - (*dir)[ents] = xcalloc(1, sizeof(***dir)); + (*dir)[ents] = xmalloc(sizeof(***dir)); (*dir)[ents]->filename = xstrdup(filename); (*dir)[ents]->longname = xstrdup(longname); memcpy(&(*dir)[ents]->a, a, sizeof(*a)); @@ -557,7 +557,7 @@ /* Don't return partial matches on interrupt */ if (interrupted && dir != NULL && *dir != NULL) { free_sftp_dirents(*dir); - *dir = xcalloc(1, sizeof(**dir)); + *dir = xmalloc(sizeof(**dir)); **dir = NULL; } @@ -761,16 +761,18 @@ } int -do_rename(struct sftp_conn *conn, char *oldpath, char *newpath) +do_rename(struct sftp_conn *conn, char *oldpath, char *newpath, + int force_legacy) { Buffer msg; u_int status, id; + int use_ext = (conn->exts & SFTP_EXT_POSIX_RENAME) && !force_legacy; buffer_init(&msg); /* Send rename request */ id = conn->msg_id++; - if ((conn->exts & SFTP_EXT_POSIX_RENAME)) { + if (use_ext) { buffer_put_char(&msg, SSH2_FXP_EXTENDED); buffer_put_int(&msg, id); buffer_put_cstring(&msg, "posix-rename@openssh.com"); @@ -782,8 +784,8 @@ buffer_put_cstring(&msg, newpath); send_msg(conn, &msg); debug3("Sent message %s \"%s\" -> \"%s\"", - (conn->exts & SFTP_EXT_POSIX_RENAME) ? "posix-rename@openssh.com" : - "SSH2_FXP_RENAME", oldpath, newpath); + use_ext ? "posix-rename@openssh.com" : "SSH2_FXP_RENAME", + oldpath, newpath); buffer_free(&msg); status = get_status(conn, id); @@ -1098,7 +1100,7 @@ (unsigned long long)offset, (unsigned long long)offset + buflen - 1, num_req, max_req); - req = xcalloc(1, sizeof(*req)); + req = xmalloc(sizeof(*req)); req->id = conn->msg_id++; req->len = buflen; req->offset = offset; @@ -1451,7 +1453,7 @@ strerror(errno)); if (len != 0) { - ack = xcalloc(1, sizeof(*ack)); + ack = xmalloc(sizeof(*ack)); ack->id = ++id; ack->offset = offset; ack->len = len;