9316 ldap: comparison between pointer and zero character constant

Review Request #979 — Created March 19, 2018 and submitted

tsoome
illumos-gate
9316
f503d74...
general
../common/ldapsearch.c:243:44: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  } else if ( sortattr == NULL || *sortattr == '\0' || server_sort) {
                                            ^~
../common/ldapsearch.c:243:34: note: did you mean to dereference the pointer?
  } else if ( sortattr == NULL || *sortattr == '\0' || server_sort) {
                                  ^
../ns_ldap/ldapclient.c:2526:36: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (adminDN == NULL || adminDN[0] == '\0') {
                                    ^~
../ns_ldap/ldapclient.c:2526:25: note: did you mean to dereference the pointer?
  if (adminDN == NULL || adminDN[0] == '\0') {
                         ^
../ns_ldap/ldapclient.c:2535:48: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (adminPassword == NULL || adminPassword[0] == '\0') {
                                                ^~
../ns_ldap/ldapclient.c:2535:31: note: did you mean to dereference the pointer?
  if (adminPassword == NULL || adminPassword[0] == '\0') {
                               ^
../ns_ldap/ldapaddent.c:112:11: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  while (c != '\0' && *c == ' ')
           ^~
../ns_ldap/ldapaddent.c:112:9: note: did you mean to dereference the pointer?
  while (c != '\0' && *c == ' ')
         ^
../ns_ldap/ldapaddent.c: In function 'genent_aliases':
../ns_ldap/ldapaddent.c:2100:10: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (++t == '\0') {
          ^~
../ns_ldap/ldapaddent.c:2100:6: note: did you mean to dereference the pointer?
  if (++t == '\0') {
      ^~

cc1: all warnings being treated as errors


  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
hadfl
  1. 
      
  2. usr/src/cmd/ldap/ns_ldap/ldapaddent.c (Diff revision 1)
     
     

    [] has a higher precedence than prefix increment. so this should probably be (++t)[0]

  3. 
      
tsoome
hadfl
  1. Ship It!
  2. 
      
seeemef@mac.com
  1. 
      
  2. usr/src/cmd/ldap/ns_ldap/ldapaddent.c (Diff revision 2)
     
     

    Hi. The (not) NUL check seems superfluous given the space equality check.

    Other LGTM.

    1. yea, no reason to keep it there.

  3. 
      
tsoome
seeemef@mac.com
  1. Ship It!
  2. 
      
citrus
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...