From a2f05a98d7ed062f293f40f88fc1237448438b15 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Wed, 3 Mar 2010 15:03:10 -0500 Subject: Improved NSPR error handling. Use PR_ErrorToString. --- nsscommon.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/nsscommon.c b/nsscommon.c index b94e3e63..ea38ffb0 100644 --- a/nsscommon.c +++ b/nsscommon.c @@ -1,7 +1,7 @@ /* Common functions used by the NSS-aware code in systemtap. - Copyright (C) 2009 Red Hat Inc. + Copyright (C) 2009, 2010 Red Hat Inc. This file is part of systemtap, and is free software. You can redistribute it and/or modify it under the terms of the GNU General Public @@ -30,27 +30,17 @@ void nssError (void) { PRErrorCode errorNumber; - PRInt32 errorTextLength; - PRInt32 rc; char *errorText; - /* See if PR_GetErrorText can tell us what the error is. */ + /* See if PR_GetError can tell us what the error is. */ errorNumber = PR_GetError (); fprintf(stderr, "(%d) ", errorNumber); if (errorNumber >= PR_NSPR_ERROR_BASE && errorNumber <= PR_MAX_ERROR) { - errorTextLength = PR_GetErrorTextLength (); - if (errorTextLength != 0) { - errorText = PORT_Alloc (errorTextLength); - rc = PR_GetErrorText (errorText); - if (rc != 0) - fprintf (stderr, "%s\n", errorText); - PR_Free (errorText); - if (rc != 0) - return; - } + fprintf (stderr, "%s\n", PR_ErrorToString(errorNumber, PR_LANGUAGE_EN)); + return; } switch (errorNumber) { -- cgit