On Fri, Oct 12, 2001 at 04:35:46PM +0400, Alexander V. Lukyanov wrote:
> * Fish protocol improved. Pseudo-tty is used now, which allows answering
> ssh yes/no questions and password query.
gcc -DHAVE_CONFIG_H -I. -I. -I../include -I../include -g -Wall
-Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -c -o
PtyShell.o `test -f PtyShell.cc || echo './'`PtyShell.cc
PtyShell.cc: In method `int PtyShell::getfd()':
PtyShell.cc:107: warning: deprecated conversion from string constant to `char *'
PtyShell.cc:108: warning: deprecated conversion from string constant to `char *'
PtyShell.cc:109: warning: deprecated conversion from string constant to `char *'
putenv() is a really stupid call--there seems to be no real way of
knowing when a string in the environment that was put there by putenv()
is gone and can be freed.
Anyhow, quick fix attached. Leaks the memory for the environment, but
it doesn't matter since it either exec()s or _exit()'s immediately
anyway.
--
Glenn Maynard
Index: PtyShell.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/PtyShell.cc,v
retrieving revision 1.2
diff -u -r1.2 PtyShell.cc
--- PtyShell.cc 2001/10/12 10:48:04 1.2
+++ PtyShell.cc 2001/10/13 01:59:55
@@ -104,9 +104,9 @@
_exit(1);
}
}
- putenv("LC_ALL=C");
- putenv("LANG=C");
- putenv("LANGUAGE=C");
+ putenv(xstrdup("LC_ALL=C"));
+ putenv(xstrdup("LANG=C"));
+ putenv(xstrdup("LANGUAGE=C"));
if(a)
execvp(a->a0(),a->GetV());
execl("/bin/sh","sh","-c",name,NULL);