mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
clean up nsUserInfoUnix.cpp. fix from Chris Seawood <cls@seawood.org>.
r=sspitzer, tested by colin blake on vms.
This commit is contained in:
parent
4113fb25e6
commit
66b5c6c373
31
configure.in
31
configure.in
@ -729,6 +729,7 @@ case "$target" in
|
||||
dnl Hack...
|
||||
_OPENVMS_CROSS_COMPILE=1
|
||||
NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
|
||||
AC_DEFINE(NO_PW_GECOS)
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -1570,6 +1571,36 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for uname.domainname)
|
||||
AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
|
||||
[AC_TRY_COMPILE([#include <sys/utsname.h>],
|
||||
[ struct utsname *res; char *domain;
|
||||
(void)uname(res); if (res != 0) { domain = res->domainname; } ],
|
||||
[ac_cv_have_uname_domainname_field=true],
|
||||
[ac_cv_have_uname_domainname_field=false])])
|
||||
|
||||
if test "$ac_cv_have_uname_domainname_field" = "true"; then
|
||||
AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for uname.__domainname)
|
||||
AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
|
||||
[AC_TRY_COMPILE([#include <sys/utsname.h>],
|
||||
[ struct utsname *res; char *domain;
|
||||
(void)uname(res); if (res != 0) { domain = res->__domainname; } ],
|
||||
[ac_cv_have_uname_us_domainname_field=true],
|
||||
[ac_cv_have_uname_us_domainname_field=false])])
|
||||
|
||||
if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
|
||||
AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
dnl ========================================================
|
||||
AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
/* Some UNIXy platforms don't have pw_gecos. In this case we use pw_name */
|
||||
#if defined(VMS)
|
||||
#if defined(NO_PW_GECOS)
|
||||
#define PW_GECOS pw_name
|
||||
#else
|
||||
#define PW_GECOS pw_gecos
|
||||
@ -57,8 +57,6 @@ nsUserInfo::GetFullname(PRUnichar **aFullname)
|
||||
|
||||
pw = getpwuid (geteuid());
|
||||
|
||||
// do I need to free pw?
|
||||
|
||||
if (!pw || !pw->PW_GECOS) return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
@ -83,8 +81,6 @@ nsUserInfo::GetUsername(char * *aUsername)
|
||||
// is this portable? those are POSIX compliant calls, but I need to check
|
||||
pw = getpwuid(geteuid());
|
||||
|
||||
// do I need to free pw?
|
||||
|
||||
if (!pw || !pw->pw_name) return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
@ -108,11 +104,11 @@ nsUserInfo::GetDomain(char * *aDomain)
|
||||
if (uname(&buf)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// I need to see why on linux it is __domainname, yet for the header file, it is domainname
|
||||
#ifdef __linux__
|
||||
|
||||
#if defined(HAVE_UNAME_DOMAINNAME_FIELD)
|
||||
domainname = buf.domainname;
|
||||
#elif defined(HAVE_UNAME_US_DOMAINNAME_FIELD)
|
||||
domainname = buf.__domainname;
|
||||
//domainname = buf.domainname;
|
||||
#endif
|
||||
|
||||
if (domainname && nsCRT::strlen(domainname)) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
/* Some UNIXy platforms don't have pw_gecos. In this case we use pw_name */
|
||||
#if defined(VMS)
|
||||
#if defined(NO_PW_GECOS)
|
||||
#define PW_GECOS pw_name
|
||||
#else
|
||||
#define PW_GECOS pw_gecos
|
||||
@ -57,8 +57,6 @@ nsUserInfo::GetFullname(PRUnichar **aFullname)
|
||||
|
||||
pw = getpwuid (geteuid());
|
||||
|
||||
// do I need to free pw?
|
||||
|
||||
if (!pw || !pw->PW_GECOS) return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
@ -83,8 +81,6 @@ nsUserInfo::GetUsername(char * *aUsername)
|
||||
// is this portable? those are POSIX compliant calls, but I need to check
|
||||
pw = getpwuid(geteuid());
|
||||
|
||||
// do I need to free pw?
|
||||
|
||||
if (!pw || !pw->pw_name) return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
@ -108,11 +104,11 @@ nsUserInfo::GetDomain(char * *aDomain)
|
||||
if (uname(&buf)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// I need to see why on linux it is __domainname, yet for the header file, it is domainname
|
||||
#ifdef __linux__
|
||||
|
||||
#if defined(HAVE_UNAME_DOMAINNAME_FIELD)
|
||||
domainname = buf.domainname;
|
||||
#elif defined(HAVE_UNAME_US_DOMAINNAME_FIELD)
|
||||
domainname = buf.__domainname;
|
||||
//domainname = buf.domainname;
|
||||
#endif
|
||||
|
||||
if (domainname && nsCRT::strlen(domainname)) {
|
||||
|
Loading…
Reference in New Issue
Block a user