[138557] trunk/base/src/darwintracelib1.0/proc.c
cal at macports.org
cal at macports.org
Sun Jul 12 03:56:11 PDT 2015
Revision: 138557
https://trac.macports.org/changeset/138557
Author: cal at macports.org
Date: 2015-07-12 03:56:10 -0700 (Sun, 12 Jul 2015)
Log Message:
-----------
base: darwintrace: refactor FD closing in exec-style functions
Modified Paths:
--------------
trunk/base/src/darwintracelib1.0/proc.c
Modified: trunk/base/src/darwintracelib1.0/proc.c
===================================================================
--- trunk/base/src/darwintracelib1.0/proc.c 2015-07-12 09:41:21 UTC (rev 138556)
+++ trunk/base/src/darwintracelib1.0/proc.c 2015-07-12 10:56:10 UTC (rev 138557)
@@ -221,6 +221,8 @@
* That _does_ save us another ugly loop to get things right. */
bytes_read = read(fd, buffer, sizeof(buffer) - 1);
buffer[bytes_read] = '\0';
+ close(fd);
+
const char *buffer_end = buffer + bytes_read;
if (bytes_read > 2 && buffer[0] == '#' && buffer[1] == '!') {
char *interp = buffer + 2;
@@ -238,12 +240,10 @@
/* check the iterpreter against the sandbox */
if (!__darwintrace_is_in_sandbox(interp, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
- close(fd);
return ENOENT;
}
}
- close(fd);
return 0;
#undef open
#undef close
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150712/9af114bc/attachment-0001.html>
More information about the macports-changes
mailing list