Discussion:
getenv issue
Shigeharu Isoda
2013-05-19 06:56:12 UTC
Permalink
Hello, Alexander.

I've recently begun to use lftp, it works great!

But I found lftp ignores getenv() return value, this causes
segmentation fault, while lftp invoked on no 'TERM' environment
variable, such as cron job.

Here is a simple patch.

Thank you!

*** src/lftp_tinfo.cc Sun May 19 14:10:47 2013
--- src/lftp_tinfo.cc.orig Tue Mar 19 21:56:07 2013
***************
*** 54,60 ****
terminfo_ok = false;
#elif defined(HAVE_TGETSTR)
static char buf[2048];
! if(getenv("TERM")==NULL||tgetent(buf,getenv("TERM")) == -1)
terminfo_ok = false;
#endif
}
--- 54,60 ----
terminfo_ok = false;
#elif defined(HAVE_TGETSTR)
static char buf[2048];
! if(tgetent(buf,getenv("TERM")) == -1)
terminfo_ok = false;
#endif
}

--
Shigeharu Isoda s-***@ricelabo.com
Alexander Lukyanov
2013-05-30 11:02:55 UTC
Permalink
I have applied the fix. It will be available in the next lftp version (in
github now).
Thank you!
Post by Shigeharu Isoda
But I found lftp ignores getenv() return value, this causes
segmentation fault, while lftp invoked on no 'TERM' environment
variable, such as cron job.
Here is a simple patch.
Loading...