[Xorp-hackers] fix for xorpsh if TERM env variable is not set

Michael Larson mike at vyatta.com
Mon Aug 21 10:28:33 PDT 2006


Here's a small fix for the xorpsh when the TERM environmental variable is not set:

--- cli_node_net.cc_orig        2006-08-21 10:21:52.000000000 -0700
+++ cli_node_net.cc     2006-08-21 10:17:53.000000000 -0700
@@ -514,8 +514,8 @@

        ; // do nothing
 #else
-       term_name = getenv("TERM");
-       if (term_name.empty())
+       char *term = getenv("TERM");
+       if (term == NULL || string(term).empty() == true)
            term_name = DEFAULT_TERM_TYPE;      // Set to default
 #endif
     }

The getenv is returning a NULL ptr which causes a crash when the assignment is applied to the string term_name. The fix is to check for NULL prior to testing for an empty string.

Mike
Vyatta



More information about the Xorp-hackers mailing list