MFV r258381:

4251 libdtrace leaks open file handles

Illumos commit:		93ed8d0d4b068b95d0bb50d57bb854df462a8485
			(partial)
Reference:
https://www.illumos.org/issues/4251

Discussed with:	Robert Mustacchi
Obtained from:	Illumos
MFC after:	1 week
This commit is contained in:
pfg 2014-06-25 17:27:15 +00:00
parent d4f8a83dc3
commit cf8bf4883d

View File

@ -2268,12 +2268,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
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,
@ -2281,8 +2284,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
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",