Mercurial > gftp.yaz
diff lib/misc.c @ 124:65048c959029
2003-4-6 Brian Masney <masneyb@gftp.org>
* lib/config_file.c src/text/gftp-text.c - changed arguments of
gftp_read_config_file() and gftp_read_bookmarks() to take an argument
to the path of the global config directory. The text/gtk+ port will
just pass SHARE_DIR. The native MacOS X port that is in the works
needs this (Nathan Robertson is currently working on this port)
* lib/gftp.h lib/config_file.c - removed config variable type
gftp_option_type_textarray
* lib/gftp.h lib/config_file.c - removed copy_function from
gftp_option_type_var. This is implemented with memcpy() instead
* lib/rfc959.c - remember to rename all instances of firewall_* to
ftp_proxy_*
* lib/sshv2.c - improved generating the argument list for the ssh
client
* lib/sshv2.c lib/misc.c lib/gftp.h - added len argument to
ptym_open()
* lib/protocols.c lib/misc.c lib/config_file.c - use g_strdup()
instead of g_malloc()/strcpy()
author | masneyb |
---|---|
date | Tue, 08 Apr 2003 01:43:33 +0000 |
parents | 76e2b58a9440 |
children | b875de05c22d |
line wrap: on
line diff
--- a/lib/misc.c Sun Apr 06 15:38:27 2003 +0000 +++ b/lib/misc.c Tue Apr 08 01:43:33 2003 +0000 @@ -124,8 +124,7 @@ struct passwd *pw; pw = NULL; - str = g_malloc (strlen (src) + 1); - strcpy (str, src); + str = g_strdup (src); if (*str == '~') { @@ -190,10 +189,7 @@ if (pw != NULL) { if ((pos = strchr (newstr, '/')) == NULL) - { - str = g_malloc (strlen (pw->pw_dir) + 1); - strcpy (str, pw->pw_dir); - } + str = g_strdup (pw->pw_dir); else str = g_strconcat (pw->pw_dir, pos, NULL); @@ -568,7 +564,7 @@ int -ptym_open (char *pts_name) +ptym_open (char *pts_name, size_t len) { int fd; @@ -578,7 +574,7 @@ if ((tempstr = _getpty (&fd, O_RDWR, 0600, 0)) == NULL) return (-1); - strcpy (pts_name, tempstr); + strncpy (pts_name, tempstr, len); return (fd); #else /* !__sgi */ @@ -587,7 +583,7 @@ char *tempstr; - strcpy (pts_name, "/dev/ptmx"); + strncpy (pts_name, "/dev/ptmx", len); if ((fd = open (pts_name, O_RDWR)) < 0) return (-1); @@ -609,14 +605,14 @@ return (-1); } - strcpy (pts_name, tempstr); + strncpy (pts_name, tempstr, len); return (fd); #else /* !GRANTPT */ char *pos1, *pos2; - strcpy (pts_name, "/dev/ptyXY"); + strncpy (pts_name, "/dev/ptyXY", len); for (pos1 = "pqrstuvwxyzPQRST"; *pos1 != '\0'; pos1++) { pts_name[8] = *pos1;