diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2023-06-16 15:42:20 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2023-06-28 04:00:13 -0300 |
commit | b963fe41ae2cd669e5819aded531375ddaebc8b2 (patch) | |
tree | a82794efe2b8b925d24a3fd413663cef1e987926 /src | |
parent | common.h: use __func__ instead of __FUNCTION__ (diff) | |
download | firejail-b963fe41ae2cd669e5819aded531375ddaebc8b2.tar.gz firejail-b963fe41ae2cd669e5819aded531375ddaebc8b2.tar.zst firejail-b963fe41ae2cd669e5819aded531375ddaebc8b2.zip |
Improve errExit error messages
Changes:
* Move msg to the end of errExit (right before perror(3p))
* Include the full file path (within the repository)
* Add "()" to function name for clarity
Before:
Error malloc: main.c:123 main: Cannot allocate memory
After:
Error src/firejail/main.c:123 main(): malloc: Cannot allocate memory
Note: This clarifies which is the exact file that the error message
comes from, as there are many source files with the same name. For
example:
$ git ls-files 'src/*/main.c' | wc -l
20
Diffstat (limited to 'src')
-rw-r--r-- | src/etc-cleanup/Makefile | 1 | ||||
-rw-r--r-- | src/fbuilder/Makefile | 1 | ||||
-rw-r--r-- | src/fcopy/Makefile | 1 | ||||
-rw-r--r-- | src/fids/Makefile | 1 | ||||
-rw-r--r-- | src/firecfg/Makefile | 1 | ||||
-rw-r--r-- | src/firejail/Makefile | 1 | ||||
-rw-r--r-- | src/firemon/Makefile | 1 | ||||
-rw-r--r-- | src/fldd/Makefile | 1 | ||||
-rw-r--r-- | src/fnet/Makefile | 1 | ||||
-rw-r--r-- | src/fnetfilter/Makefile | 1 | ||||
-rw-r--r-- | src/fnettrace-dns/Makefile | 1 | ||||
-rw-r--r-- | src/fnettrace-icmp/Makefile | 1 | ||||
-rw-r--r-- | src/fnettrace-sni/Makefile | 1 | ||||
-rw-r--r-- | src/fnettrace/Makefile | 1 | ||||
-rw-r--r-- | src/fsec-optimize/Makefile | 1 | ||||
-rw-r--r-- | src/fsec-print/Makefile | 1 | ||||
-rw-r--r-- | src/fseccomp/Makefile | 1 | ||||
-rw-r--r-- | src/ftee/Makefile | 1 | ||||
-rw-r--r-- | src/fzenity/Makefile | 1 | ||||
-rw-r--r-- | src/include/common.h | 3 | ||||
-rw-r--r-- | src/jailcheck/Makefile | 1 | ||||
-rw-r--r-- | src/lib/Makefile | 1 | ||||
-rw-r--r-- | src/libpostexecseccomp/Makefile | 1 | ||||
-rw-r--r-- | src/libtrace/Makefile | 1 | ||||
-rw-r--r-- | src/libtracelog/Makefile | 1 | ||||
-rw-r--r-- | src/profstats/Makefile | 1 |
26 files changed, 27 insertions, 1 deletions
diff --git a/src/etc-cleanup/Makefile b/src/etc-cleanup/Makefile index c3c482bdb..296ed41d8 100644 --- a/src/etc-cleanup/Makefile +++ b/src/etc-cleanup/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/etc-cleanup | ||
5 | PROG = etc-cleanup | 6 | PROG = etc-cleanup |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index 634bf725f..1f6a28780 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fbuilder | ||
5 | PROG = fbuilder | 6 | PROG = fbuilder |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile index a3c4abe9d..f82d3a073 100644 --- a/src/fcopy/Makefile +++ b/src/fcopy/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fcopy | ||
5 | PROG = fcopy | 6 | PROG = fcopy |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fids/Makefile b/src/fids/Makefile index 76388a03d..c03740e3d 100644 --- a/src/fids/Makefile +++ b/src/fids/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fids | ||
5 | PROG = fids | 6 | PROG = fids |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index de4639ab6..322ce3e3f 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/firecfg | ||
5 | PROG = firecfg | 6 | PROG = firecfg |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/firejail/Makefile b/src/firejail/Makefile index d3a4b4f81..a817b1757 100644 --- a/src/firejail/Makefile +++ b/src/firejail/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/firejail | ||
5 | PROG = firejail | 6 | PROG = firejail |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/firemon/Makefile b/src/firemon/Makefile index 09387f3eb..649bad0af 100644 --- a/src/firemon/Makefile +++ b/src/firemon/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/firemon | ||
5 | PROG = firemon | 6 | PROG = firemon |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fldd/Makefile b/src/fldd/Makefile index 7fec70a33..00173d18e 100644 --- a/src/fldd/Makefile +++ b/src/fldd/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fldd | ||
5 | PROG = fldd | 6 | PROG = fldd |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 50bfdfffd..04a200951 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fnet | ||
5 | PROG = fnet | 6 | PROG = fnet |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile index 156af3ed0..d38185fb1 100644 --- a/src/fnetfilter/Makefile +++ b/src/fnetfilter/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fnetfilter | ||
5 | PROG = fnetfilter | 6 | PROG = fnetfilter |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile index bbd4772e2..fb1054261 100644 --- a/src/fnettrace-dns/Makefile +++ b/src/fnettrace-dns/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fnettrace-dns | ||
5 | PROG = fnettrace-dns | 6 | PROG = fnettrace-dns |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fnettrace-icmp/Makefile b/src/fnettrace-icmp/Makefile index 0d26dc2fc..4791e0b9f 100644 --- a/src/fnettrace-icmp/Makefile +++ b/src/fnettrace-icmp/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fnettrace-icmp | ||
5 | PROG = fnettrace-icmp | 6 | PROG = fnettrace-icmp |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile index 554741fc8..09a444db0 100644 --- a/src/fnettrace-sni/Makefile +++ b/src/fnettrace-sni/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fnettrace-sni | ||
5 | PROG = fnettrace-sni | 6 | PROG = fnettrace-sni |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile index 94381d299..fe74afda2 100644 --- a/src/fnettrace/Makefile +++ b/src/fnettrace/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fnettrace | ||
5 | PROG = fnettrace | 6 | PROG = fnettrace |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile index 5a14726a0..12ac5f1a9 100644 --- a/src/fsec-optimize/Makefile +++ b/src/fsec-optimize/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fsec-optimize | ||
5 | PROG = fsec-optimize | 6 | PROG = fsec-optimize |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile index d55167796..a506c1106 100644 --- a/src/fsec-print/Makefile +++ b/src/fsec-print/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fsec-print | ||
5 | PROG = fsec-print | 6 | PROG = fsec-print |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index f8c35d41f..a7d88eb83 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fseccomp | ||
5 | PROG = fseccomp | 6 | PROG = fseccomp |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/ftee/Makefile b/src/ftee/Makefile index 0c27b4cbc..1b1cdec43 100644 --- a/src/ftee/Makefile +++ b/src/ftee/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/ftee | ||
5 | PROG = ftee | 6 | PROG = ftee |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile index 148babbe8..cb80ec0bc 100644 --- a/src/fzenity/Makefile +++ b/src/fzenity/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/fzenity | ||
5 | PROG = fzenity | 6 | PROG = fzenity |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/include/common.h b/src/include/common.h index 23b00b6f8..4a2b8c1bf 100644 --- a/src/include/common.h +++ b/src/include/common.h | |||
@@ -41,7 +41,8 @@ | |||
41 | 41 | ||
42 | #define errExit(msg) do { \ | 42 | #define errExit(msg) do { \ |
43 | char msgout[500]; \ | 43 | char msgout[500]; \ |
44 | snprintf(msgout, 500, "Error %s: %s:%d %s", msg, __FILE__, __LINE__, __func__); \ | 44 | snprintf(msgout, 500, "Error %s/%s:%d %s(): %s", \ |
45 | MOD_DIR, __FILE__, __LINE__, __func__, msg); \ | ||
45 | perror(msgout); \ | 46 | perror(msgout); \ |
46 | exit(1); \ | 47 | exit(1); \ |
47 | } while (0) | 48 | } while (0) |
diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile index 3b0b83412..0b57861c6 100644 --- a/src/jailcheck/Makefile +++ b/src/jailcheck/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/jailcheck | ||
5 | PROG = jailcheck | 6 | PROG = jailcheck |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||
diff --git a/src/lib/Makefile b/src/lib/Makefile index a7b093048..9cf8abe36 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/lib | ||
5 | TARGET = lib | 6 | TARGET = lib |
6 | 7 | ||
7 | include $(ROOT)/src/prog.mk | 8 | include $(ROOT)/src/prog.mk |
diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index c5ec14672..c9e25d066 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/libpostexecseccomp | ||
5 | SO = libpostexecseccomp.so | 6 | SO = libpostexecseccomp.so |
6 | TARGET = $(SO) | 7 | TARGET = $(SO) |
7 | 8 | ||
diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 8b14a4335..337529361 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/libtrace | ||
5 | SO = libtrace.so | 6 | SO = libtrace.so |
6 | TARGET = $(SO) | 7 | TARGET = $(SO) |
7 | 8 | ||
diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index 2b43ce131..3e9d9e3e3 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/libtracelog | ||
5 | SO = libtracelog.so | 6 | SO = libtracelog.so |
6 | TARGET = $(SO) | 7 | TARGET = $(SO) |
7 | 8 | ||
diff --git a/src/profstats/Makefile b/src/profstats/Makefile index ae88bf2fd..aa947401e 100644 --- a/src/profstats/Makefile +++ b/src/profstats/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | ROOT = ../.. | 2 | ROOT = ../.. |
3 | -include $(ROOT)/config.mk | 3 | -include $(ROOT)/config.mk |
4 | 4 | ||
5 | MOD_DIR = src/profstats | ||
5 | PROG = profstats | 6 | PROG = profstats |
6 | TARGET = $(PROG) | 7 | TARGET = $(PROG) |
7 | 8 | ||