From patchwork Wed Sep 27 14:22:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 819199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463060-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Tan29HiG"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y2Kn84Gx3z9t3h for ; Thu, 28 Sep 2017 00:23:32 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=vkC2y4zapHVtr4ntJ3XLREDSxQAYIt5RwGLhyYcl+ToCHT sBGxb59RzNmPmoujd1cvA4kmBCb43HDKQFOU2aF8tKU9Vb7gCxp1gaG91CNI9IO0 U5xyMwdOelIaL5e5VzU6XyuZh55vLmfmu0EckkQ8sRsINR71B44obYZH/nJ2c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=RAPF0Rj43EJwlyzbPDp0aFvk/X8=; b=Tan29HiGOFwu0lKL5jud lrJV1/ipLUi6CvT5L9pd0baZA8bSVPtrqsbJn4/xw0rLIOno306i4UZvi9SegYTe IHD64/vf7tJE/dqvVjN2cNnh4npSZCntBkTQBfP9fTv8nytRgvVCusQtVM40341X KhbnUe6Ip2d618OhSpubrRo= Received: (qmail 98599 invoked by alias); 27 Sep 2017 14:22:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 98504 invoked by uid 89); 27 Sep 2017 14:22:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Sep 2017 14:22:47 +0000 Received: by mail-wm0-f48.google.com with SMTP id q124so18926821wmb.0 for ; Wed, 27 Sep 2017 07:22:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=v0y2YAQF4gK5MvmtaW29/z8zbi96XCXDDUQdzVEtEsI=; b=uAfMO2XrFVB4sotxVVPGbBIZ5+koYhs6EWOD2pBcKSEAONeT3TJdabRInjPSmwBi89 g0geCy4XKKr+VC91kY8AmZpl0HL9PuI0fhHM5YViBMPuSsMjRPHs2Cps4HVLDJ7G0M6E 2BdP6PhFK8qnrYVmuSg2JMJ2vvAoAfzeqRmj8r6yenAcuUc9JBwIXUKf7JbbJhsQe1P+ 0sM/Pu+jqS5EVvcmcEa27ctkfNJNe6Dm9uG2s2YgENG4+JbMFO6M/+vPVIS31JcF4HsS kkO7bSKg50AcO7c4tvW/3Q2wfVDd0jXRrWtyPNu6TjMqEf/6leF72T1ZNgbMHspkzYYx iQ7Q== X-Gm-Message-State: AHPjjUiMkwT2hIhEs6it66TTj0FlKSNgODfIVZ+tV716lM5CutLqC11q Ml5/i/ByzBUJOpUTkzUA7xU1KDGi8EGooAdw64DJDfeA X-Google-Smtp-Source: AOwi7QCTA6ZWFx69nbXzj/LQJQiiI7eW5WGLZ1crN7N0pIYtSVpIrpKR5A8hb03nAWfZ09P2tNx50gR45/2rD98vjLc= X-Received: by 10.80.153.213 with SMTP id n21mr2030085edb.28.1506522165477; Wed, 27 Sep 2017 07:22:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.179.240 with HTTP; Wed, 27 Sep 2017 07:22:44 -0700 (PDT) From: Ian Lance Taylor Date: Wed, 27 Sep 2017 07:22:44 -0700 Message-ID: Subject: libgo patch committed: Check Getsockname error return To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch by Tony Reix checks for errors from Getsockname in a couple of places. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 253105) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -e0c1f0b645b12a544b484c0f477f8fb6f5980550 +cdf1f58c7578980e1d1949680c7e404961b7c153 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/net/sock_posix.go =================================================================== --- libgo/go/net/sock_posix.go (revision 253025) +++ libgo/go/net/sock_posix.go (working copy) @@ -182,7 +182,10 @@ func (fd *netFD) listenStream(laddr sock if err := fd.init(); err != nil { return err } - lsa, _ := syscall.Getsockname(fd.pfd.Sysfd) + lsa, err := syscall.Getsockname(fd.pfd.Sysfd) + if err != nil { + return os.NewSyscallError("getsockname", err) + } fd.setAddr(fd.addrFunc()(lsa), nil) return nil } @@ -221,7 +224,10 @@ func (fd *netFD) listenDatagram(laddr so if err := fd.init(); err != nil { return err } - lsa, _ := syscall.Getsockname(fd.pfd.Sysfd) + lsa, err := syscall.Getsockname(fd.pfd.Sysfd) + if err != nil { + return os.NewSyscallError("getsockname", err) + } fd.setAddr(fd.addrFunc()(lsa), nil) return nil }