mount: improve code readability

Static analyzers (e.g., Coverity) have a hard time understanding why
'optarg' is tested for NULL, and later in another place, code assumes
that it's non-NULL. For idmapping, the optarg is required.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2023-05-23 10:47:18 +02:00
parent a5e0e06cc2
commit a5eba5046d

View file

@ -863,7 +863,7 @@ int main(int argc, char **argv)
break;
case MOUNT_OPT_MAP_GROUPS:
case MOUNT_OPT_MAP_USERS:
if (optarg && *optarg == '=')
if (*optarg == '=')
optarg++;
if (idmap && (*idmap == '/' || *optarg == '/')) {
warnx(_("bad usage"));