From owner-svn-src-head@freebsd.org Fri Sep 29 16:30:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A3DFE3008E; Fri, 29 Sep 2017 16:30:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 230CF6C6F5; Fri, 29 Sep 2017 16:30:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8TGUoTc038156; Fri, 29 Sep 2017 16:30:50 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TGUo8N038154; Fri, 29 Sep 2017 16:30:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201709291630.v8TGUo8N038154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 29 Sep 2017 16:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324103 - head/lib/libc/locale X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/lib/libc/locale X-SVN-Commit-Revision: 324103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Sep 2017 16:30:51 -0000 Author: bdrewery Date: Fri Sep 29 16:30:50 2017 New Revision: 324103 URL: https://svnweb.freebsd.org/changeset/base/324103 Log: __setrunelocale: Fix asprintf(3) failure not returning an error. Also fix the style of the asprintf(3) call in __collate_load_tables_l(). Both of these lines were modified away from snprintf(3) during the import from DragonFly/Illumos. Reviewed by: jilles (briefly over shoulder) MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libc/locale/collate.c head/lib/libc/locale/setrunelocale.c Modified: head/lib/libc/locale/collate.c ============================================================================== --- head/lib/libc/locale/collate.c Fri Sep 29 15:53:26 2017 (r324102) +++ head/lib/libc/locale/collate.c Fri Sep 29 16:30:50 2017 (r324103) @@ -125,8 +125,7 @@ __collate_load_tables_l(const char *encoding, struct x return (_LDP_CACHE); } - asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding); - if (buf == NULL) + if (asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding) == -1) return (_LDP_ERROR); if ((fd = _open(buf, O_RDONLY)) < 0) { Modified: head/lib/libc/locale/setrunelocale.c ============================================================================== --- head/lib/libc/locale/setrunelocale.c Fri Sep 29 15:53:26 2017 (r324102) +++ head/lib/libc/locale/setrunelocale.c Fri Sep 29 16:30:50 2017 (r324103) @@ -110,9 +110,8 @@ __setrunelocale(struct xlocale_ctype *l, const char *e } /* Range checking not needed, encoding length already checked before */ - asprintf(&path, "%s/%s/LC_CTYPE", _PathLocale, encoding); - if (path == NULL) - return (0); + if (asprintf(&path, "%s/%s/LC_CTYPE", _PathLocale, encoding) == -1) + return (errno); if ((rl = _Read_RuneMagi(path)) == NULL) { free(path);