Mercurial > gftp.yaz
changeset 504:93d7d3b9a477
2004-7-18 Brian Masney <masneyb@gftp.org>
* lib/local.c lib/protocols.c lib/rfc959.c src/uicommon/gftpui.c - fixes
for the *_chmod() functions to use the datatype mode_t for storing
the file attributes
author | masneyb |
---|---|
date | Sun, 18 Jul 2004 16:19:15 +0000 |
parents | eb6dafc07f42 |
children | c89019945241 |
files | ChangeLog lib/local.c lib/protocols.c lib/rfc959.c src/uicommon/gftpui.c |
diffstat | 5 files changed, 16 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jul 18 15:57:40 2004 +0000 +++ b/ChangeLog Sun Jul 18 16:19:15 2004 +0000 @@ -1,4 +1,8 @@ 2004-7-18 Brian Masney <masneyb@gftp.org> + * lib/local.c lib/protocols.c lib/rfc959.c src/uicommon/gftpui.c - fixes + for the *_chmod() functions to use the datatype mode_t for storing + the file attributes + * acinclude.m4 - quote the definition of the automake functions. This fixes warnings from automake 1.8 @@ -2576,7 +2580,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.281 2004/07/18 15:57:40 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.282 2004/07/18 16:19:14 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/local.c Sun Jul 18 15:57:40 2004 +0000 +++ b/lib/local.c Sun Jul 18 16:19:15 2004 +0000 @@ -504,27 +504,21 @@ static int local_chmod (gftp_request * request, const char *file, mode_t mode) { - char buf[10]; - int newmode; - g_return_val_if_fail (request != NULL, GFTP_EFATAL); g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); g_return_val_if_fail (file != NULL, GFTP_EFATAL); - g_snprintf (buf, sizeof (buf), "%d", mode); - newmode = strtol (buf, NULL, 8); - - if (chmod (file, newmode) == 0) + if (chmod (file, mode) == 0) { request->logging_function (gftp_logging_misc, request, - _("Successfully changed mode of %s to %d\n"), + _("Successfully changed mode of %s to %o\n"), file, mode); return (0); } else { request->logging_function (gftp_logging_error, request, - _("Error: Could not change mode of %s to %d: %s\n"), + _("Error: Could not change mode of %s to %o: %s\n"), file, mode, g_strerror (errno)); return (GFTP_ERETRYABLE); }
--- a/lib/protocols.c Sun Jul 18 15:57:40 2004 +0000 +++ b/lib/protocols.c Sun Jul 18 16:19:15 2004 +0000 @@ -1000,6 +1000,8 @@ if (request->chmod == NULL) return (GFTP_EFATAL); + + mode &= S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX; return (request->chmod (request, file, mode)); }
--- a/lib/rfc959.c Sun Jul 18 15:57:40 2004 +0000 +++ b/lib/rfc959.c Sun Jul 18 16:19:15 2004 +0000 @@ -1659,13 +1659,15 @@ rfc959_chmod (gftp_request * request, const char *file, mode_t mode) { char *tempstr, ret; + size_t len; g_return_val_if_fail (request != NULL, GFTP_EFATAL); g_return_val_if_fail (file != NULL, GFTP_EFATAL); g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL); - tempstr = g_malloc (strlen (file) + (mode / 10) + 16); - sprintf (tempstr, "SITE CHMOD %d %s\r\n", mode, file); + len = strlen (file) + (mode / 10) + 20; + tempstr = g_malloc (len); + snprintf (tempstr, len, "SITE CHMOD %o %s\r\n", mode, file); ret = rfc959_send_command (request, tempstr, 1); g_free (tempstr);
--- a/src/uicommon/gftpui.c Sun Jul 18 15:57:40 2004 +0000 +++ b/src/uicommon/gftpui.c Sun Jul 18 16:19:15 2004 +0000 @@ -1447,7 +1447,8 @@ if (!curfle->is_fd && preserve_permissions) { if (curfle->st_mode != 0) - gftp_chmod (tdata->toreq, curfle->destfile, curfle->st_mode); + gftp_chmod (tdata->toreq, curfle->destfile, + curfle->st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)); if (curfle->datetime != 0) gftp_set_file_time (tdata->toreq, curfle->destfile,