Date: Wed, 12 Oct 2005 22:03:43 +0100 From: RW <list-freebsd-2004@morbius.sent.com> To: freebsd-questions@freebsd.org Cc: "Michael C. Shultz" <ringworm01@gmail.com> Subject: Re: portmanager Message-ID: <200510122203.45229.list-freebsd-2004@morbius.sent.com> In-Reply-To: <200510121242.55482.ringworm01@gmail.com> References: <629544090.20051009185315@reaper.hn.org> <200510121242.55482.ringworm01@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 12 October 2005 20:42, Michael C. Shultz wrote:
> On Sunday 09 October 2005 07:53, Michael Lednev wrote:
> > Hello, freebsd-questions.
> >
> > anyone tried to run portmanager from crontab? as for me it just
> > coredumps, what am i doing wrong? its simply 0 0 * * * portmanager -s
>
> I'm not sure how to fix it but I've found where portmanager crashes
> when run from cron, the code is:
>
>
> if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout))
> ) {
> stringSize = strlen( id )
> + 1
> + strlen( VERSION )
> + 1;
> xtermTitle = malloc( stringSize );
> xtermTitle[0] = 0;
> strcat( xtermTitle, id );
> strcat( xtermTitle, " " );
> strcat( xtermTitle, VERSION );
> printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
> free( xtermTitle );
> }
>
>
> This is used to put information in the xterm title screen while portmanager
> is running, I don't know enough about cron to have a clue how to fix this
> except to remove it and I don't want to do that. Anyone have any ideas?
I think getenv() returns NULL if a variable isn't defined, and strncmp() will
try to dereference any pointer it's given without checking.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510122203.45229.list-freebsd-2004>
