#ifndef WIN32
70: static void
71: findusername(std::string &username)
72: {
73: // LOGNAME environment var has two advantages:
74: // 1) avoids problems of getlogin(3) and cuserid(3)
75: // 2) unlike getpwuid, takes into account user
76: // customization of the environment.
77: // Try both LOGNAME and USER env. var.
78: const char *user = Process::getEnv("LOGNAME");
79: // if ( !strcmp(user,"") )
---------------------^^^^ !
79: if ( ! user || !strcmp(user,"") )
80: user = Process::getEnv("USER");
81: if ( user )
82: username = user;
83: else
84: username = "";
85: }
------------------------
ln 79 'user' might be 0 and should therefore be checked before using it.
Thanks,
Arjan Knepper
_______________________________________________
Ccrtp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ccrtp-devel