From ad4339ac357de846308adca5098f06a1652b23fb Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 19 Oct 2002 20:11:14 +0000 Subject: 2002-10-19 Roland McGrath * unix.c (ftp_conn_unix_start_get_stats): Pass dirname a copy of NAME instead of the original pointer. --- libftpconn/unix.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libftpconn/unix.c b/libftpconn/unix.c index 7a5136f8..e2a460c7 100644 --- a/libftpconn/unix.c +++ b/libftpconn/unix.c @@ -1,8 +1,7 @@ /* Unix-specific ftpconn hooks - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - - Written by Miles Bader + Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc. + Written by Miles Bader This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -224,7 +223,7 @@ ftp_conn_unix_start_get_stats (struct ftp_conn *conn, than looking it up directly, as not all ftp servers support the -d option to ls. To make sure we get a directory, append '/', except for the root directory. */ - char *dirn = dirname ((char *) name); + char *dirn = dirname (strdupa (name)); int is_root = ! strcmp (dirn, "/"); req_len += strlen (dirn) + (is_root ? 0 : 1); req = malloc (req_len); @@ -244,7 +243,7 @@ ftp_conn_unix_start_get_stats (struct ftp_conn *conn, else sprintf (req, "%s %s%s", flags, slash ? "" : "./", name); } - + if (err) goto out; -- cgit v1.2.3