Message ID | 20210804004109.1476661-1-irogers@google.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 89de27f981cc183f8dec5e87ebbc30e223720f8f |
Headers | show |
Series | [1/2] libtracefs: Silence non-literal-null-conversion warning | expand |
On Tue, 3 Aug 2021 17:41:08 -0700 Ian Rogers <irogers@google.com> wrote: > diff --git a/src/tracefs-utils.c b/src/tracefs-utils.c > index 63bb413..a502c2d 100644 > --- a/src/tracefs-utils.c > +++ b/src/tracefs-utils.c > @@ -470,7 +470,7 @@ int tracefs_list_pop(char **list) > size--; > *list = (char *)size; > list++; > - list[size] = '\0'; > + list[size] = NULL; Regardless of a clang warning, that code was an oops. Thanks for the fix. -- Steve > return 0; > } >
diff --git a/src/tracefs-utils.c b/src/tracefs-utils.c index 63bb413..a502c2d 100644 --- a/src/tracefs-utils.c +++ b/src/tracefs-utils.c @@ -470,7 +470,7 @@ int tracefs_list_pop(char **list) size--; *list = (char *)size; list++; - list[size] = '\0'; + list[size] = NULL; return 0; }
On clang the warning looks like: src/tracefs-utils.c:473:15: error: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Werror,-Wnon-literal-null-conversion] list[size] = '\0'; Signed-off-by: Ian Rogers <irogers@google.com> --- src/tracefs-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)