clsync / clsync

file live sync daemon based on inotify/kqueue/bsm (Linux, FreeBSD), written in GNU C

Home Page:http://ut.mephi.ru/oss/clsync

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix gcc-9 warnings

bircoph opened this issue · comments

Gcc-9 found several warnings. Most severe one is in a separate #166. Others are here. False positives are possible, but they are still worth investigation:

fileutils.c: In function 'fd2fpath_malloc':
fileutils.c:52:2: warning: passing argument 2 to restrict-qualified parameter aliases with argument 1 [-Wrestrict]
   52 |  if ( ( fpathlen = readlink ( fpath, fpath, fpathlen + 1 ) ) < 0 ) {
      |  ^~
privileged.c: In function 'privileged_action':
privileged.c:1428:43: warning: 'start_ticks' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1428 |    unsigned long delay = ( long ) clock() - ( long ) start_ticks;
      |                          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:507,
                 from common.h:38,
                 from privileged.c:20:
In function 'strncpy',
    inlined from '__privileged_inotify_add_watch_procsplit' at privileged.c:1677:2:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from '__privileged_fork_setuid_execvp_procsplit' at privileged.c:1731:2:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'privileged_handler' at privileged.c:1105:7:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'privileged_handler' at privileged.c:1106:7:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sync.c: In function 'thread_info':
sync.c:192:37: warning: missing braces around initializer [-Wmissing-braces]
  192 |  static threadsinfo_t threadsinfo = {{{{0}}}, {{{0}}}, 0, 0, 0, NULL, NULL, 0};
      |                                     ^
      |                                                  {}
sync.c:192:37: warning: missing braces around initializer [-Wmissing-braces]
  192 |  static threadsinfo_t threadsinfo = {{{{0}}}, {{{0}}}, 0, 0, 0, NULL, NULL, 0};
      |                                     ^
      |                                                  {}
sync.c:192:37: warning: missing braces around initializer [-Wmissing-braces]
  192 |  static threadsinfo_t threadsinfo = {{{{0}}}, {{{0}}}, 0, 0, 0, NULL, NULL, 0};
      |                                     ^
      |                                                  {}

Looks like all done now.