X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust-comm%2Flttng-ust-fd-tracker.c;h=282895911c65569c6a5050bb859b9e73383c1a5a;hb=c1be081a2f016fb6dcaef1d471389ede3aa00103;hp=329339f98a038736fe528bc856bdeff1737b4c2b;hpb=f5c453e975e5d417590b9a1be2a9f8504db063c0;p=lttng-ust.git diff --git a/liblttng-ust-comm/lttng-ust-fd-tracker.c b/liblttng-ust-comm/lttng-ust-fd-tracker.c index 329339f9..28289591 100644 --- a/liblttng-ust-comm/lttng-ust-fd-tracker.c +++ b/liblttng-ust-comm/lttng-ust-fd-tracker.c @@ -61,6 +61,9 @@ * Protect the lttng_fd_set. Nests within the ust_lock, and therefore * within the libc dl lock. Therefore, we need to fixup the TLS before * nesting into this lock. + * + * The ust_safe_guard_fd_mutex nests within the ust_mutex. This mutex + * is also held across fork. */ static pthread_mutex_t ust_safe_guard_fd_mutex = PTHREAD_MUTEX_INITIALIZER; /* @@ -146,7 +149,7 @@ void lttng_ust_unlock_fd_tracker(void) static int dup_std_fd(int fd) { - int ret; + int ret, i; int fd_to_close[STDERR_FILENO + 1]; int fd_to_close_count = 0; int dup_cmd = F_DUPFD; /* Default command */ @@ -171,7 +174,7 @@ static int dup_std_fd(int fd) } /* Perform dup */ - for (int i = 0; i < STDERR_FILENO + 1; i++) { + for (i = 0; i < STDERR_FILENO + 1; i++) { ret = fcntl(fd, dup_cmd, 0); if (ret < 0) { PERROR("fcntl dup fd"); @@ -192,7 +195,7 @@ static int dup_std_fd(int fd) } /* Close intermediary fds */ - for (int i = 0; i < fd_to_close_count; i++) { + for (i = 0; i < fd_to_close_count; i++) { ret = close(fd_to_close[i]); if (ret) { PERROR("close on temporary fd: %d.", fd_to_close[i]);