Skip to content

Commit

Permalink
Use noreturn attribute for printexit
Browse files Browse the repository at this point in the history
This tells the compiler and static analyzers that we exit; in
this case clang-analyzer was warning about a possible `NULL` deref
in `mountcomposefs.c` that wasn't reachable.

That said, this function is the same thing as `errx`, but we can
fix that as a followup.

Signed-off-by: Colin Walters <walters@verbum.org>
  • Loading branch information
cgwalters committed Aug 31, 2023
1 parent a6e2770 commit c5def3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/cfs-fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ uint64_t erofs_build_time;
uint32_t erofs_build_time_nsec;
int basedir_fd;

static void printexit(const char *format, ...) __attribute__((noreturn));
static void printexit(const char *format, ...)
{
va_list args;
Expand Down
1 change: 1 addition & 0 deletions tools/mountcomposefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include "libcomposefs/lcfs-mount.h"

static void printexit(const char *format, ...) __attribute__((noreturn));
static void printexit(const char *format, ...)
{
va_list args;
Expand Down

0 comments on commit c5def3d

Please sign in to comment.