diff --git a/config.mk.in b/config.mk.in index f3c1f658cb9..c76ca1a981f 100644 --- a/config.mk.in +++ b/config.mk.in @@ -83,7 +83,7 @@ LDFLAGS=@LDFLAGS@ # Project variables EXTRA_CFLAGS =@EXTRA_CFLAGS@ COMMON_CFLAGS = \ - -ggdb -O2 -DVERSION='"$(VERSION)"' \ + -ggdb -O2 -DVERSION='"$(VERSION)"' -DMOD_DIR='"$(MOD_DIR)"' \ -Wall -Wextra $(HAVE_FATAL_WARNINGS) \ -Wformat -Wformat-security \ -fstack-protector-all -D_FORTIFY_SOURCE=2 \ diff --git a/src/etc-cleanup/Makefile b/src/etc-cleanup/Makefile index c3c482bdbef..296ed41d8fa 100644 --- a/src/etc-cleanup/Makefile +++ b/src/etc-cleanup/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/etc-cleanup PROG = etc-cleanup TARGET = $(PROG) diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index 634bf725f37..1f6a28780f5 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fbuilder PROG = fbuilder TARGET = $(PROG) diff --git a/src/fbuilder/utils.c b/src/fbuilder/utils.c index fa432d003ce..91c5a1a5ef9 100644 --- a/src/fbuilder/utils.c +++ b/src/fbuilder/utils.c @@ -34,10 +34,8 @@ int is_dir(const char *fname) { rv = stat(fname, &s); else { char *tmp; - if (asprintf(&tmp, "%s/", fname) == -1) { - fprintf(stderr, "Error: cannot allocate memory, %s:%d\n", __FILE__, __LINE__); + if (asprintf(&tmp, "%s/", fname) == -1) errExit("asprintf"); - } rv = stat(tmp, &s); free(tmp); } diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile index a3c4abe9dde..f82d3a073fc 100644 --- a/src/fcopy/Makefile +++ b/src/fcopy/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fcopy PROG = fcopy TARGET = $(PROG) diff --git a/src/fids/Makefile b/src/fids/Makefile index 76388a03df0..c03740e3dfc 100644 --- a/src/fids/Makefile +++ b/src/fids/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fids PROG = fids TARGET = $(PROG) diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index de4639ab661..322ce3e3fbe 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/firecfg PROG = firecfg TARGET = $(PROG) diff --git a/src/firejail/Makefile b/src/firejail/Makefile index d3a4b4f81f7..a817b17570b 100644 --- a/src/firejail/Makefile +++ b/src/firejail/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/firejail PROG = firejail TARGET = $(PROG) diff --git a/src/firejail/util.c b/src/firejail/util.c index 55548691649..87b771867c1 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c @@ -559,10 +559,8 @@ int is_dir(const char *fname) { rv = stat_as_user(fname, &s); else { char *tmp; - if (asprintf(&tmp, "%s/", fname) == -1) { - fprintf(stderr, "Error: cannot allocate memory, %s:%d\n", __FILE__, __LINE__); + if (asprintf(&tmp, "%s/", fname) == -1) errExit("asprintf"); - } rv = stat_as_user(tmp, &s); free(tmp); } diff --git a/src/firemon/Makefile b/src/firemon/Makefile index 09387f3eb7c..649bad0af67 100644 --- a/src/firemon/Makefile +++ b/src/firemon/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/firemon PROG = firemon TARGET = $(PROG) diff --git a/src/fldd/Makefile b/src/fldd/Makefile index 7fec70a3326..00173d18e76 100644 --- a/src/fldd/Makefile +++ b/src/fldd/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fldd PROG = fldd TARGET = $(PROG) diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 50bfdfffdd2..04a2009514e 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fnet PROG = fnet TARGET = $(PROG) diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile index 156af3ed02c..d38185fb194 100644 --- a/src/fnetfilter/Makefile +++ b/src/fnetfilter/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fnetfilter PROG = fnetfilter TARGET = $(PROG) diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile index bbd4772e26d..fb10542616f 100644 --- a/src/fnettrace-dns/Makefile +++ b/src/fnettrace-dns/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fnettrace-dns PROG = fnettrace-dns TARGET = $(PROG) diff --git a/src/fnettrace-icmp/Makefile b/src/fnettrace-icmp/Makefile index 0d26dc2fc59..4791e0b9f31 100644 --- a/src/fnettrace-icmp/Makefile +++ b/src/fnettrace-icmp/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fnettrace-icmp PROG = fnettrace-icmp TARGET = $(PROG) diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile index 554741fc8cd..09a444db01f 100644 --- a/src/fnettrace-sni/Makefile +++ b/src/fnettrace-sni/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fnettrace-sni PROG = fnettrace-sni TARGET = $(PROG) diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile index 94381d29973..fe74afda293 100644 --- a/src/fnettrace/Makefile +++ b/src/fnettrace/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fnettrace PROG = fnettrace TARGET = $(PROG) diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile index 5a14726a099..12ac5f1a9c3 100644 --- a/src/fsec-optimize/Makefile +++ b/src/fsec-optimize/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fsec-optimize PROG = fsec-optimize TARGET = $(PROG) diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile index d5516779628..a506c110659 100644 --- a/src/fsec-print/Makefile +++ b/src/fsec-print/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fsec-print PROG = fsec-print TARGET = $(PROG) diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index f8c35d41fb1..a7d88eb83eb 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fseccomp PROG = fseccomp TARGET = $(PROG) diff --git a/src/ftee/Makefile b/src/ftee/Makefile index 0c27b4cbcee..1b1cdec437b 100644 --- a/src/ftee/Makefile +++ b/src/ftee/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/ftee PROG = ftee TARGET = $(PROG) diff --git a/src/ftee/main.c b/src/ftee/main.c index a34a76b2666..20e25c2021e 100644 --- a/src/ftee/main.c +++ b/src/ftee/main.c @@ -148,10 +148,8 @@ static int is_dir(const char *fname) { rv = stat(fname, &s); else { char *tmp; - if (asprintf(&tmp, "%s/", fname) == -1) { - fprintf(stderr, "Error: cannot allocate memory, %s:%d\n", __FILE__, __LINE__); - exit(1); - } + if (asprintf(&tmp, "%s/", fname) == -1) + errExit("asprintf"); rv = stat(tmp, &s); free(tmp); } diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile index 148babbe89e..cb80ec0bcd4 100644 --- a/src/fzenity/Makefile +++ b/src/fzenity/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/fzenity PROG = fzenity TARGET = $(PROG) diff --git a/src/include/common.h b/src/include/common.h index a0ad8c7653d..4a2b8c1bfbc 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -32,11 +32,20 @@ #include #include +#if !defined(__func__) && defined(__FUNCTION__) +#define __func__ __FUNCTION__ +#endif + // dbus proxy path used by firejail and firemon #define XDG_DBUS_PROXY_PATH "/usr/bin/xdg-dbus-proxy" - -#define errExit(msg) do { char msgout[500]; snprintf(msgout, 500, "Error %s: %s:%d %s", msg, __FILE__, __LINE__, __FUNCTION__); perror(msgout); exit(1);} while (0) +#define errExit(msg) do { \ + char msgout[500]; \ + snprintf(msgout, 500, "Error %s/%s:%d %s(): %s", \ + MOD_DIR, __FILE__, __LINE__, __func__, msg); \ + perror(msgout); \ + exit(1); \ +} while (0) // macro to print ip addresses in a printf statement #define PRINT_IP(A) \ diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile index 3b0b834124b..0b57861c6ea 100644 --- a/src/jailcheck/Makefile +++ b/src/jailcheck/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/jailcheck PROG = jailcheck TARGET = $(PROG) diff --git a/src/lib/Makefile b/src/lib/Makefile index a7b09304867..9cf8abe3652 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/lib TARGET = lib include $(ROOT)/src/prog.mk diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index c5ec1467293..c9e25d066c9 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/libpostexecseccomp SO = libpostexecseccomp.so TARGET = $(SO) diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 8b14a433509..337529361b7 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/libtrace SO = libtrace.so TARGET = $(SO) diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index 2b43ce1316b..3e9d9e3e365 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/libtracelog SO = libtracelog.so TARGET = $(SO) diff --git a/src/profstats/Makefile b/src/profstats/Makefile index ae88bf2fd3e..aa947401e4f 100644 --- a/src/profstats/Makefile +++ b/src/profstats/Makefile @@ -2,6 +2,7 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_DIR = src/profstats PROG = profstats TARGET = $(PROG) diff --git a/test/appimage/filename.exp b/test/appimage/filename.exp index 9d9127fb51b..f2b827bb627 100755 --- a/test/appimage/filename.exp +++ b/test/appimage/filename.exp @@ -24,7 +24,7 @@ after 100 send -- "firejail --appimage appimage.sh\r" expect { timeout {puts "TESTING ERROR 2\n";exit} - "Error mounting appimage" + -re "Error .*mounting appimage" } after 100