From 2a03ed4ad4ede7f6739a11eed39666a5007a5235 Mon Sep 17 00:00:00 2001 From: Vincent JARDIN Date: Sat, 3 Feb 2024 01:37:17 +0100 Subject: [PATCH 1/2] Add missing end of file It is an isolated commit so next one will be focused on specific updates. --- src/include/gtp_bpf_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/gtp_bpf_utils.h b/src/include/gtp_bpf_utils.h index dcd5725..ac4c780 100644 --- a/src/include/gtp_bpf_utils.h +++ b/src/include/gtp_bpf_utils.h @@ -60,4 +60,4 @@ static inline unsigned int bpf_num_possible_cpus(void) (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER)) #endif -#endif \ No newline at end of file +#endif From d3d7e98256c6649e9908d49864d8f2158a1af06b Mon Sep 17 00:00:00 2001 From: Vincent JARDIN Date: Sat, 3 Feb 2024 01:39:12 +0100 Subject: [PATCH 2/2] cosmetic: exit() SUCCESS or FAILURE It is a minor cosmetic change while reading the code. --- src/include/gtp_bpf_utils.h | 2 +- src/main.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/include/gtp_bpf_utils.h b/src/include/gtp_bpf_utils.h index ac4c780..74a4cc7 100644 --- a/src/include/gtp_bpf_utils.h +++ b/src/include/gtp_bpf_utils.h @@ -35,7 +35,7 @@ static inline unsigned int bpf_num_possible_cpus(void) if (possible_cpus < 0) { printf("Failed to get # of possible cpus: '%s'!\n", strerror(-possible_cpus)); - exit(1); + exit(EXIT_FAILURE); } return possible_cpus; } diff --git a/src/main.c b/src/main.c index 4a9a5a9..f41ed36 100644 --- a/src/main.c +++ b/src/main.c @@ -64,7 +64,7 @@ stop_gtp(void) #endif closelog(); pidfile_rm(PROG_PID_FILE); - exit(0); + exit(EXIT_SUCCESS); } /* Daemon init sequence */ @@ -174,11 +174,11 @@ parse_cmdline(int argc, char **argv) case 'v': fprintf(stderr, VERSION_STRING "\n"); fprintf(stderr, "libbpf %s\n", libbpf_version_string()); - exit(0); + exit(EXIT_SUCCESS); break; case 'h': usage(argv[0]); - exit(0); + exit(EXIT_SUCCESS); break; case 'l': debug |= 1; @@ -216,7 +216,7 @@ parse_cmdline(int argc, char **argv) bad_option = true; break; default: - exit(1); + exit(EXIT_FAILURE); break; } curind = optind; @@ -231,7 +231,7 @@ parse_cmdline(int argc, char **argv) } if (bad_option) - exit(1); + exit(EXIT_FAILURE); } /* Entry point */ @@ -296,5 +296,5 @@ main(int argc, char **argv) */ end: closelog(); - exit(0); + exit(EXIT_SUCCESS); }