Mercurial > gftp.yaz
diff lib/sshv2.c @ 529:c36a475ecf5a
2004-8-9 Brian Masney <masneyb@gftp.org>
* lib/sshv2.c - fixes so that file permissions are preserved properly
on file upload. Fixes so that the Utime and Chmod commands are shown
in the log window
author | masneyb |
---|---|
date | Tue, 10 Aug 2004 02:55:35 +0000 |
parents | d32b05e07284 |
children | 65cd664cbf32 |
line wrap: on
line diff
--- a/lib/sshv2.c Tue Aug 10 02:29:09 2004 +0000 +++ b/lib/sshv2.c Tue Aug 10 02:55:35 2004 +0000 @@ -561,13 +561,16 @@ case SSH_FXP_SETSTAT: memcpy (&num, message + 4, 4); num = ntohl (num); - pos = message + 12 + num - 1; - oldchar = *pos; - *pos = '\0'; + memcpy (&stattype, message + 8 + num, 4); stattype = ntohl (stattype); memcpy (&attr, message + 12 + num, 4); attr = ntohl (attr); + + pos = message + 8 + num; + oldchar = *pos; + *pos = '\0'; + switch (stattype) { case SSH_FILEXFER_ATTR_PERMISSIONS: @@ -580,6 +583,7 @@ _("%d: Utime %s %d\n"), id, message + 8, attr); } + *pos = oldchar; break; case SSH_FXP_STATUS: @@ -1493,7 +1497,7 @@ num = htonl (SSH_FILEXFER_ATTR_PERMISSIONS); memcpy (endpos, &num, 4); - g_snprintf (buf, sizeof (buf), "%d", mode); + g_snprintf (buf, sizeof (buf), "%o", mode); num = htonl (strtol (buf, NULL, 8)); memcpy (endpos + 4, &num, 4);