From patchwork Fri Feb 1 17:21:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 217537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "userp1040.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B4FFC2C0095 for ; Sat, 2 Feb 2013 04:21:20 +1100 (EST) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r11HLH0f001977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Feb 2013 17:21:17 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r11HLGYn019773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 1 Feb 2013 17:21:17 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1U1KIe-0006fs-NG; Fri, 01 Feb 2013 09:21:16 -0800 Received: from aserp1030.oracle.com ([141.146.126.68]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1U1KIc-0006fe-5s for fedfs-utils-devel@oss.oracle.com; Fri, 01 Feb 2013 09:21:14 -0800 Received: from mail-ia0-f181.google.com (mail-ia0-f181.google.com [209.85.210.181]) by aserp1030.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r11HLDAa010745 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 1 Feb 2013 17:21:13 GMT Received: by mail-ia0-f181.google.com with SMTP id k25so5685748iah.12 for ; Fri, 01 Feb 2013 09:21:13 -0800 (PST) X-Received: by 10.50.217.230 with SMTP id pb6mr1788337igc.43.1359739273131; Fri, 01 Feb 2013 09:21:13 -0800 (PST) Received: from seurat.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net. [99.26.161.222]) by mx.google.com with ESMTPS id hg2sm2573811igc.3.2013.02.01.09.21.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 01 Feb 2013 09:21:12 -0800 (PST) From: Chuck Lever To: fedfs-utils-devel@oss.oracle.com Date: Fri, 01 Feb 2013 12:21:11 -0500 Message-ID: <20130201172111.63192.38685.stgit@seurat.1015granger.net> In-Reply-To: <20130201171714.63192.68358.stgit@seurat.1015granger.net> References: <20130201171714.63192.68358.stgit@seurat.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Flow-Control-Info: class=Default reputation=ipRepBelow100 ip=209.85.210.181 ct-class=R5 ct-vol1=-87 ct-vol2=8 ct-vol3=8 ct-risk=48 ct-spam1=77 ct-spam2=5 ct-bulk=4 rcpts=1 size=2239 X-MM-CT-Classification: not spam X-MM-CT-RefID: str=0001.0A090206.510BF98A.0015, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Subject: [fedfs-utils] [PATCH 10/13] fedfsc: Display LDAP errors consistently X-BeenThere: fedfs-utils-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list Reply-To: fedfs-utils Developers List-Id: fedfs-utils Developers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: fedfs-utils-devel-bounces@oss.oracle.com Errors-To: fedfs-utils-devel-bounces@oss.oracle.com X-Source-IP: acsinet22.oracle.com [141.146.126.238] Clean up: code in fedfs-lookup-junction and fedfs-lookup-replication to display LDAP errors should be consistent. Both should display the error on stderr. Signed-off-by: Chuck Lever --- src/fedfsc/fedfs-lookup-junction.c | 15 ++++++++++----- src/fedfsc/fedfs-lookup-replication.c | 7 ++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/fedfsc/fedfs-lookup-junction.c b/src/fedfsc/fedfs-lookup-junction.c index 09fd6ad..659665b 100644 --- a/src/fedfsc/fedfs-lookup-junction.c +++ b/src/fedfsc/fedfs-lookup-junction.c @@ -201,19 +201,24 @@ fedfs_lookup_junction_print_resok(FedFsLookupResOk result) } static void -fedfs_lookup_junction_print_result(FedFsLookupRes result) +fedfs_lookup_junction_print_ldapresultcode(FedFsLookupRes result) { - int ldap_err; + int ldap_err = result.FedFsLookupRes_u.ldapResultCode; + + fprintf(stderr, "LDAP result code (%d): %s\n", + ldap_err, ldap_err2string(ldap_err)); +} +static void +fedfs_lookup_junction_print_result(FedFsLookupRes result) +{ nsdb_print_fedfsstatus(result.status); switch (result.status) { case FEDFS_OK: fedfs_lookup_junction_print_resok(result.FedFsLookupRes_u.resok); break; case FEDFS_ERR_NSDB_LDAP_VAL: - ldap_err = result.FedFsLookupRes_u.ldapResultCode; - fprintf(stderr, "LDAP result code (%d): %s\n", - ldap_err, ldap_err2string(ldap_err)); + fedfs_lookup_junction_print_ldapresultcode(result); break; default: break; diff --git a/src/fedfsc/fedfs-lookup-replication.c b/src/fedfsc/fedfs-lookup-replication.c index 993882a..2e2332c 100644 --- a/src/fedfsc/fedfs-lookup-replication.c +++ b/src/fedfsc/fedfs-lookup-replication.c @@ -204,9 +204,10 @@ fedfs_lookup_replication_print_resok(FedFsLookupResOk result) static void fedfs_lookup_replication_print_ldapresultcode(FedFsLookupRes result) { - int ldap_result = result.FedFsLookupRes_u.ldapResultCode; - printf("LDAP result code (%d): %s\n", - ldap_result, ldap_err2string(ldap_result)); + int ldap_err = result.FedFsLookupRes_u.ldapResultCode; + + fprintf(stderr, "LDAP result code (%d): %s\n", + ldap_err, ldap_err2string(ldap_err)); } static void