mount_main: Fix empty string check
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Wed, 13 Jun 2018 09:48:39 +0000 (11:48 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 19 Jul 2018 00:13:54 +0000 (01:13 +0100)
gcc 7.3.0 complains:

```
usr/utils/mount_main.c: In function â€˜print_mount’:
usr/utils/mount_main.c:46:46: warning: comparison between pointer and zero character constant [-Wpointer-compare]
   if (mnt->mnt_type != NULL && mnt->mnt_type != '\0')
                                              ^~
usr/utils/mount_main.c:46:32: note: did you mean to dereference the pointer?
   if (mnt->mnt_type != NULL && mnt->mnt_type != '\0')
                                ^
usr/utils/mount_main.c:48:46: warning: comparison between pointer and zero character constant [-Wpointer-compare]
   if (mnt->mnt_opts != NULL && mnt->mnt_opts != '\0')
                                              ^~
usr/utils/mount_main.c:48:32: note: did you mean to dereference the pointer?
   if (mnt->mnt_opts != NULL && mnt->mnt_opts != '\0')
                                ^
```

Gbp-Pq: Name mount_main-Fix-empty-string-check.patch

usr/utils/mount_main.c

index ab3cb718f0039073304948788f1576e026126d99..0d299c43f436af9130558b5edb6da0bfedd0cf51 100644 (file)
@@ -43,9 +43,9 @@ static __noreturn print_mount(char *type)
                if (type && mnt->mnt_type && strcmp(type, mnt->mnt_type))
                        continue;
                printf("%s on %s", mnt->mnt_fsname, mnt->mnt_dir);
-               if (mnt->mnt_type != NULL && mnt->mnt_type != '\0')
+               if (mnt->mnt_type != NULL && *mnt->mnt_type != '\0')
                        printf(" type %s", mnt->mnt_type);
-               if (mnt->mnt_opts != NULL && mnt->mnt_opts != '\0')
+               if (mnt->mnt_opts != NULL && *mnt->mnt_opts != '\0')
                        printf(" (%s)", mnt->mnt_opts);
                printf("\n");
        }