summaryrefslogtreecommitdiffstats
path: root/src/prof.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prof.c')
-rw-r--r--src/prof.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/prof.c b/src/prof.c
index a1ca9e2..32760e6 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -1414,7 +1414,9 @@ prof_open_maps(const char *format, ...) {
mfd = open(filename, O_RDONLY | O_CLOEXEC);
#else
mfd = open(filename, O_RDONLY);
- fcntl(mfd, F_SETFD, fcntl(mfd, F_GETFD) | FD_CLOEXEC);
+ if (mfd != -1) {
+ fcntl(mfd, F_SETFD, fcntl(mfd, F_GETFD) | FD_CLOEXEC);
+ }
#endif
return mfd;