[PATCH v1] libtracefs: Fix the /dev/null redirection compatibility in Makefile

Haiyue Wang <[email protected]> Sat, 24 May 2025 01:47:24 +0800
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
"&> /dev/null" is bash shell syntax, use more compatible syntax to handle
shell null redirection.

/bin/sh: 1: /root/linux/libtracefs/test: not found
In file included from /root/linux/libtracefs/test.c:1:
/usr/local/include/tracefs/tracefs.h:11:10: fatal error: event-parse.h: No such file or directory
   11 | #include <event-parse.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

Signed-off-by: Haiyue Wang <[email protected]>
---
The same fix as for libtraceevent:
https://lore.kernel.org/linux-trace-devel/[email protected]/
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index c407589..95bf219 100644
--- a/Makefile
+++ b/Makefile
@@ -274,8 +274,8 @@ define install_ld_config
 	if $(LDCONFIG); then \
 		if ! grep -q "^$(libdir)$$" $(LD_SO_CONF_PATH)/* ; then \
 			$(CC) -o $(objtree)/test $(srctree)/test.c -I $(includedir_SQ) \
-				-L $(libdir_SQ) -ltracefs &> /dev/null; \
-			if ! $(objtree)/test &> /dev/null; then \
+				-L $(libdir_SQ) -ltracefs > /dev/null 2>&1; \
+			if ! $(objtree)/test > /dev/null 2>&1; then \
 				$(call print_install, trace.conf, $(LD_SO_CONF_PATH)) \
 				echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
 				$(LDCONFIG); \
-- 
2.49.0