From patchwork Fri Nov 6 18:41:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Reed X-Patchwork-Id: 58086 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA6IfnCc013653 for ; Fri, 6 Nov 2009 18:41:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753186AbZKFSln (ORCPT ); Fri, 6 Nov 2009 13:41:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754705AbZKFSln (ORCPT ); Fri, 6 Nov 2009 13:41:43 -0500 Received: from relay1.sgi.com ([192.48.179.29]:39773 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753186AbZKFSlm (ORCPT ); Fri, 6 Nov 2009 13:41:42 -0500 Received: from estes.americas.sgi.com (estes.americas.sgi.com [128.162.236.10]) by relay1.corp.sgi.com (Postfix) with ESMTP id 01AC38F80C8 for ; Fri, 6 Nov 2009 10:41:47 -0800 (PST) Received: from [128.162.233.78] (hd28.americas.sgi.com [128.162.233.78]) by estes.americas.sgi.com (Postfix) with ESMTP id 8CC4B7000103; Fri, 6 Nov 2009 12:41:47 -0600 (CST) Message-ID: <4AF46DEB.7090105@sgi.com> Date: Fri, 06 Nov 2009 12:41:47 -0600 From: Michael Reed User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: linux-rdma@vger.kernel.org Cc: Sammy Wilborn , Jeremy Higdon Subject: [PATCH 1/1] opensm/main.c: opensm cannot be killed while asking for port guid X-Enigmail-Version: 0.95.7 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org --- /tmp/OFED-1.5-rc2/main.c 2009-11-06 08:56:59.089100487 -0800 +++ opensm/main.c 2009-11-06 09:42:34.698963811 -0800 @@ -434,15 +434,19 @@ static ib_net64_t get_port_guid(IN osm_o i + 1, cl_ntoh64(attr_array[i].port_guid), attr_array[i].lid, ib_get_port_state_str(attr_array[i].link_state)); - printf("\nEnter choice (1-%u): ", i); + printf("\n\t0: Exit\n"); + printf("\nEnter choice (0-%u): ", i); fflush(stdout); if (scanf("%u", &choice) <= 0) { char junk[128]; if (scanf("%s", junk) <= 0) printf("\nError: Cannot scan!\n"); - } else if (choice && choice <= num_ports) + } + else if (choice == 0) + return (0); + else if (choice <= num_ports) break; - printf("\nError: Lame choice!\n"); + printf("\nError: Please try again.\n"); } choice--; printf("Choice guid=0x%" PRIx64 "\n", @@ -1039,6 +1043,9 @@ int main(int argc, char *argv[]) if (opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID)) opt.guid = get_port_guid(&osm, opt.guid); + if (opt.guid == 0) + goto Exit; + status = osm_opensm_bind(&osm, opt.guid); if (status != IB_SUCCESS) { printf("\nError from osm_opensm_bind (0x%X)\n", status);