portmanager

Mark J. Sommer msommer at argotsoft.com
Wed Oct 12 13:43:34 PDT 2005


Just a comment from an on-looker to this post.  From the getenv

The getenv() function obtains the current value of the environment vari-
     able, name. If the variable name is not in the current environment, a
     null pointer is returned.

So it could potentially be passing in a null pointer to strncmp which is not
good.  Is that the problem you're seeing.  Easy enough to test the return
from getenv before using it.

-----Original Message-----
From: owner-freebsd-questions at freebsd.org
[mailto:owner-freebsd-questions at freebsd.org] On Behalf Of Michael C. Shultz
Sent: 10/12/2005 1:43 PM
To: Michael Lednev; freebsd-questions at freebsd.org; hackers at freebsd.org
Subject: Re: portmanager

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?
This particualr code snippet is from portmanager/portmanager.c around line
137....

-Mike

ps. I've cross posted this to freebsd-hackers because it is a coding
problem, so you may want to remove freebsd-questions from any replies.
.




_______________________________________________
freebsd-questions at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"





More information about the freebsd-hackers mailing list