]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: pacify GCC 6 with -Wnull-dereference
authorBernhard Voelker <mail@bernhard-voelker.de>
Wed, 27 Jul 2016 07:33:19 +0000 (09:33 +0200)
committerBernhard Voelker <mail@bernhard-voelker.de>
Wed, 27 Jul 2016 19:28:49 +0000 (21:28 +0200)
commit558ce3044d5e22890b272b4e90f3ac0b236726a0
tree904f9bb9fbe50eede508504e4c1b3e70c5b93e27
parentf0e0f3ac924746b9436f8f54da467162b7c78ee3
maint: pacify GCC 6 with -Wnull-dereference

src/id.c:249:29: error: potential null pointer dereference \
[-Werror=null-dereference]
       pw_name = xstrdup (pwd->pw_name);
                          ~~~^~~~~~~~~
src/whoami.c:89:11: error: potential null pointer dereference \
[-Werror=null-dereference]
   puts (pw->pw_name);
         ~~^~~~~~~~~

* src/id.c (main): Explicitly exit with EXIT_FAILURE after an eror to
help gcc-6 to detect that the dereferenced pointer is valid.
* src/whoami.c (main): Likewise.
src/id.c
src/whoami.c