Fix possible error on close
[lttng-tools.git] / ltt-sessiond / trace.c
index 40ba95136713e492d9c49aab05c000b6a23d699a..e0051cd1cabe0e7d50bd783c4b4a48d67429e925 100644 (file)
@@ -297,8 +297,10 @@ void trace_destroy_kernel_session(struct ltt_kernel_session *session)
        DBG("[trace] Closing session fd %d", session->fd);
        /* Close kernel fds */
        close(session->fd);
-       DBG("[trace] Closing metadata stream fd %d", session->metadata_stream_fd);
-       close(session->metadata_stream_fd);
+       if (session->metadata_stream_fd != 0) {
+               DBG("[trace] Closing metadata stream fd %d", session->metadata_stream_fd);
+               close(session->metadata_stream_fd);
+       }
 
        trace_destroy_kernel_metadata(session->metadata);
 
This page took 0.02298 seconds and 4 git commands to generate.