svn commit: r316935 - vendor/illumos/dist/lib/libzfs/common

Andriy Gapon avg at FreeBSD.org
Fri Apr 14 18:56:02 UTC 2017


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 at 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 <josef.sipek at nexenta.com>
  Reviewed by: John Kennedy <john.kennedy at delphix.com>
  Approved by: Richard Lowe <richlowe at richlowe.net>
  Author: Simon Klinkert <simon.klinkert at gmail.com>

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);


More information about the svn-src-vendor mailing list