trace-cmd: libtrace-cmd: Fix glob() return value checks

glob() is defined to return zero on success or various GLOB_*
error constants, but those are not defined to be negative. In
fact, glibc makes them positive, and as a result the checks
don't do anything at all on glibc, but erroneously abort on
other libc implementations (such as bionic) that use negative
values for GLOB_* errors.

Fix this to compare against 0 only, adding documentation as
to which error result codes are possible.

Link: https://lore.kernel.org/20250703115450.14313-2-johannes@sipsolutions.net
Fixes: 3de68e3ec662 ("trace-cmd: Only record the formats of the events being recorded")
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index 00b87a1..c333553 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -882,7 +882,8 @@
 	globbuf.gl_offs = 0;
 	ret = glob(path, 0, NULL, &globbuf);
 	free(path);
-	if (ret < 0)
+	/* no request flags, so only GLOB_NOSPACE and GLOB_NOMATCH */
+	if (ret != 0)
 		return;
 
 	for (i = 0; i < globbuf.gl_pathc; i++) {