Skip to contentSkip to conversation

trace-cmd: Fix typo in use of file descriptor in conditional

PATCH New Steven Rostedt 1 participant 1 message Sep 4, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Fix typo in use of file descriptor in conditional

From: "Uhanov, Kirill" <[email protected]>

tracecmd_create_buffer_recorder_maxkb() opens a file and uses fd2 as the variable name to store the descriptor but the proceeding check on the status of the opened file uses the variable name fd instead.

---

lib/trace-cmd/trace-recorder.c +1 -1
index 0bd0657..650b259 100644
@@ -244,7 +244,7 @@ tracecmd_create_buffer_recorder_maxkb(const char *file, int cpu, unsigned flags,
 		goto out;
 
 	fd2 = open(file2, O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE, 0644);
-	if (fd < 0)
+	if (fd2 < 0)
 		goto err;
 
 	recorder = tracecmd_create_buffer_recorder_fd2(fd, fd2, cpu, flags, buffer, maxkb);