Date: Wed, 20 Nov 2013 11:04:15 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r258381 - vendor/illumos/dist/lib/libdtrace/common Message-ID: <201311201104.rAKB4FE8060029@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Wed Nov 20 11:04:14 2013 New Revision: 258381 URL: http://svnweb.freebsd.org/changeset/base/258381 Log: 4251 libdtrace leaks open file handles 4250 libdtrace should use "F" specifier on fopen() illumos/illumos-gate@93ed8d0d4b068b95d0bb50d57bb854df462a8485 Modified: vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Modified: vendor/illumos/dist/lib/libdtrace/common/dt_cc.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Wed Nov 20 11:03:11 2013 (r258380) +++ vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Wed Nov 20 11:04:14 2013 (r258381) @@ -2149,7 +2149,7 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons (void) snprintf(fname, sizeof (fname), "%s/%s", path, dp->d_name); - if ((fp = fopen(fname, "r")) == NULL) { + if ((fp = fopen(fname, "rF")) == NULL) { dt_dprintf("skipping library %s: %s\n", fname, strerror(errno)); continue; @@ -2171,12 +2171,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons dt_dprintf("skipping library %s, already processed " "library with the same name: %s", dp->d_name, dld->dtld_library); + (void) fclose(fp); continue; } dtp->dt_filetag = fname; - if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) + if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) { + (void) fclose(fp); return (-1); /* preserve dt_errno */ + } rv = dt_compile(dtp, DT_CTX_DPROG, DTRACE_PROBESPEC_NAME, NULL, @@ -2184,8 +2187,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons if (rv != NULL && dtp->dt_errno && (dtp->dt_errno != EDT_COMPILER || - dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) + dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) { + (void) fclose(fp); return (-1); /* preserve dt_errno */ + } if (dtp->dt_errno) dt_dprintf("error parsing library %s: %s\n",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311201104.rAKB4FE8060029>