From owner-svn-src-all@freebsd.org Fri Apr 14 18:56:01 2017 Return-Path: Delivered-To: svn-src-all@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 E7E75D3E21C; Fri, 14 Apr 2017 18:56:01 +0000 (UTC) (envelope-from avg@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 B462A94F; Fri, 14 Apr 2017 18:56:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3EIu0pb085001; Fri, 14 Apr 2017 18:56:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3EIu0Du085000; Fri, 14 Apr 2017 18:56:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201704141856.v3EIu0Du085000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 14 Apr 2017 18:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r316935 - vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 18:56:02 -0000 Author: avg Date: Fri Apr 14 18:56:00 2017 New Revision: 316935 URL: https://svnweb.freebsd.org/changeset/base/316935 Log: 5704 libzfs can only handle 255 file descriptors illumos/illumos-gate@bde3d612a7c090234c60e6e4578821237a5db135 https://github.com/illumos/illumos-gate/commit/bde3d612a7c090234c60e6e4578821237a5db135 https://www.illumos.org/issues/5704 libzfs uses fopen(), at least in libzfs_init(). If there are more than 255 filedescriptors open, fopen() will fail unless you give 'F' as the last mode character. The fix would be to give 'rF' instead of 'r' as mode to fopen(). Reviewed by: Josef 'Jeff' Sipek Reviewed by: John Kennedy Approved by: Richard Lowe Author: Simon Klinkert Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_util.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Fri Apr 14 18:54:11 2017 (r316934) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Fri Apr 14 18:56:00 2017 (r316935) @@ -626,13 +626,13 @@ libzfs_init(void) return (NULL); } - if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) { + if ((hdl->libzfs_mnttab = fopen(MNTTAB, "rF")) == NULL) { (void) close(hdl->libzfs_fd); free(hdl); return (NULL); } - hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "r"); + hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "rF"); if (libzfs_core_init() != 0) { (void) close(hdl->libzfs_fd);