#48919 Compiler warnings while building 389-ds-base on RHEL7
Closed: wontfix None Opened 8 years ago by vashirov.

From brew build.log:

--
ldap/servers/slapd/tools/ldif.c: In function 'main':
ldap/servers/slapd/tools/ldif.c:135:5: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
     (void)fgets(buf+curlen, maxlen/2 + 1, stdin);
     ^
--
ldap/servers/slapd/tools/mmldif.c: In function 'readrec':
ldap/servers/slapd/tools/mmldif.c:778:17: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
                 (void)fgets(line, sizeof(line), edf1->fp);
                 ^
ldap/servers/slapd/tools/mmldif.c:816:17: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
                 (void)fgets(line, sizeof(line), edf1->fp);
                 ^
--
ldap/servers/slapd/detach.c: In function 'detach':
ldap/servers/slapd/detach.c:87:5: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
     (void) chdir( "/" );
     ^
ldap/servers/slapd/detach.c:93:5: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
     (void) chdir( errorlog );
     ^
ldap/servers/slapd/detach.c:102:4: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
    (void) chdir( workingdir );
    ^
--
ldap/servers/slapd/saslbind.c:544:16: warning: variable 'inited' set but not used [-Wunused-but-set-variable]
     static int inited = 0;
                ^
--
ldap/servers/slapd/agtmmap.c: In function 'agt_mopen_stats':
ldap/servers/slapd/agtmmap.c:163:20: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
                    (void)write (fd, buf, sz);
                    ^
--
ldap/servers/slapd/agtmmap.c: In function 'agt_mopen_stats':
ldap/servers/slapd/agtmmap.c:163:20: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
                    (void)write (fd, buf, sz);
                    ^
--
ldap/servers/slapd/attrsyntax.c: In function 'attr_syntax_force_to_delete':
ldap/servers/slapd/attrsyntax.c:1393:36: warning: variable 'fi' set but not used [-Wunused-but-set-variable]
  struct attr_syntax_enum_flaginfo *fi;
                                    ^
--
ldap/servers/slapd/localhost.c: In function 'find_localhost_DNS':
ldap/servers/slapd/localhost.c:121:23: warning: ignoring return value of 'getdomainname', declared with attribute warn_unused_result [-Wunused-result]
         getdomainname (line, sizeof(line));
                       ^
--
ldap/servers/slapd/protect_db.c: In function 'grab_lockfile':
ldap/servers/slapd/protect_db.c:63:14: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
         write(fd, (void *) &pid, sizeof(pid_t));
              ^
ldap/servers/slapd/protect_db.c:82:22: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
                 write(fd, (void *) &pid, sizeof(pid_t));
                      ^
--
ldap/servers/slapd/util.c: In function 'util_info_sys_pages':
ldap/servers/slapd/util.c:1595:18: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
             fgets(s, 79, f);
                  ^
ldap/servers/slapd/util.c:1617:18: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
             fgets(s, 79, fm);
                  ^
--
lib/base/fsmutex.cpp: In function 'void fsmutex_setowner(FSMUTEX, uid_t, gid_t)':
lib/base/fsmutex.cpp:89:56: warning: ignoring return value of 'int chown(const char*, __uid_t, __gid_t)', declared with attribute warn_unused_result [-Wunused-result]
         (void) chown( ((fsmutex_s *)fsm)->id, uid, gid);
                                                        ^
--
ldap/servers/slapd/back-ldbm/idl_new.c: In function 'idl_new_range_fetch':
ldap/servers/slapd/back-ldbm/idl_new.c:555:27: warning: 'suffix' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 } else if ((key == suffix) || idl_id_is_in_idlist(idl, key)) {
                           ^
ldap/servers/slapd/back-ldbm/idl_new.c:555:66: warning: 'key' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 } else if ((key == suffix) || idl_id_is_in_idlist(idl, key)) {
                                                                  ^
--
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c: In function 'ldbm_instance_post_delete_instance_entry_callback':
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c:1137:29: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
                         int rc;
                             ^
--
ldap/servers/slapd/back-ldbm/ldif2ldbm.c: In function 'ldbm_back_ldbm2ldif':
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1353:14: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
         write(fd, vstr, strlen(vstr));
              ^
ldap/servers/slapd/back-ldbm/ldif2ldbm.c: In function 'export_one_entry':
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1021:14: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
         write(expargs->fd, idstr, strlen(idstr));
              ^
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1023:10: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
     write(expargs->fd, data.data, len);
          ^
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1024:10: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
     write(expargs->fd, "\n", 1);
          ^
--
ldap/servers/slapd/tools/ldclt/ldapfct.c: In function 'ldclt_flush_genldif':
ldap/servers/slapd/tools/ldclt/ldapfct.c:2555:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
   write (mctx.genldifFile, ldclt_write_genldif_buf, ldclt_write_genldif_nb);
         ^
--
ldap/servers/snmp/main.c: In function 'main':
ldap/servers/snmp/main.c:77:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
         fscanf(pid_fp, "%d", &child_pid);
               ^
ldap/servers/snmp/main.c:162:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
         fscanf(pid_fp, "%d", &child_pid);
               ^
--



gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-8)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And from clang:

ldap/servers/slapd/localhost.c:121:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        getdomainname (line, sizeof(line));
        ^~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~
1 warning generated.
ldap/servers/slapd/protect_db.c:63:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        write(fd, (void *) &pid, sizeof(pid_t));
        ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/slapd/protect_db.c:82:17: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
                write(fd, (void *) &pid, sizeof(pid_t));
                ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
ldap/servers/slapd/util.c:1595:13: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
            fgets(s, 79, f);
            ^~~~~ ~~~~~~~~
ldap/servers/slapd/util.c:1617:13: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
            fgets(s, 79, fm);
            ^~~~~ ~~~~~~~~~
2 warnings generated.
lib/base/fsmutex.cpp: In function 'void fsmutex_setowner(FSMUTEX, uid_t, gid_t)':
lib/base/fsmutex.cpp:89:56: warning: ignoring return value of 'int chown(const char*, __uid_t, __gid_t)', declared with attribute warn_unused_result [-Wunused-result]
         (void) chown( ((fsmutex_s *)fsm)->id, uid, gid);
                                                        ^
ldap/servers/plugins/acl/acllas.c:193:23: warning: unused variable 'type_objectClass' [-Wunused-const-variable]
static char* const      type_objectClass = "objectclass";
                        ^
1 warning generated.
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1021:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        write(expargs->fd, idstr, strlen(idstr));
        ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1023:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    write(expargs->fd, data.data, len);
    ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1024:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
    write(expargs->fd, "\n", 1);
    ^~~~~ ~~~~~~~~~~~~~~~~~~~~
ldap/servers/slapd/back-ldbm/ldif2ldbm.c:1353:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        write(fd, vstr, strlen(vstr));
        ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
ldap/servers/slapd/tools/ldclt/ldapfct.c:2555:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
  write (mctx.genldifFile, ldclt_write_genldif_buf, ldclt_write_genldif_nb);
  ^~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
ldap/servers/snmp/main.c:77:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        fscanf(pid_fp, "%d", &child_pid);
        ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/snmp/main.c:162:9: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
        fscanf(pid_fp, "%d", &child_pid);
        ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.



clang --version
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-redhat-linux-gnu
Thread model: posix

Forgot to mention: this is rebuild of 389-ds-base-1.3.5.10 rpm.

Thank you for your comment and ack, William.

Since I did not get strong NO on this proposal, I'm going to push it.

Pushed to master:
6d50ba5..18c6029 master -> master
commit 18c6029

Reviewed by William (Thanks!!)

Pushed to master:
975e0fa..7c9853e master -> master
commit 7c9853e

Pushed to master:
7c9853e..381caf5 master -> master
commit 381caf5

{{{
1. 389-ds-base-1.3.5.10/ldap/servers/plugins/pwdstorage/clear_pwd.c:0: scope_hint: In function 'clear_pw_cmp'
2. 389-ds-base-1.3.5.10/ldap/servers/plugins/pwdstorage/clear_pwd.c:29:9: warning: unused variable 'len' [-Wunused-variable]

int len = 0;

^

27| {

28| int result = 0;

29|-> int len = 0;

30| int len_user = strlen(userpwd);

31| int len_dbp = strlen(dbpwd);

}}}

Metadata Update from @nhosoi:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.3.5.11

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1978

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

4 years ago

Log in to comment on this ticket.

Metadata