[PATCH] libtracefs: Use tracefs_warning() for tracefs_user_event_record() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

Instead of hard coding fprintf() into the library, allow the application
to control the output, and use tracefs_warning() instead.
Also switch the setting of the errno, as tracefs_warning() will
add a perror() to the message.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 src/tracefs-userevents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tracefs-userevents.c b/src/tracefs-userevents.c
index ccd511b3045d..7da6aa35bf12 100644
--- a/src/tracefs-userevents.c
+++ b/src/tracefs-userevents.c
@@ -504,13 +504,13 @@ int tracefs_user_event_record(struct tracefs_user_event *event,
 	return writev(e->group->fd, head, used);
 
 bad_length:
-	fprintf(stderr, "Bad user_event item length at index %d\n",
-		used - 1);
 	errno = EINVAL;
+	tracefs_warning("Bad user_event item length at index %d\n",
+		used - 1);
 	return -1;
 
 bad_count:
-	fprintf(stderr, "Too many user_event items passed\n");
 	errno = E2BIG;
+	tracefs_warning("Too many user_event items passed\n");
 	return -1;
 }
-- 
2.34.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux