diff --git a/.gitignore b/.gitignore index e5705ce..0827ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/synce4l-1.0.0.tar.gz +/synce4l-1.1.0.tar.gz diff --git a/sources b/sources index 3e5e33e..807a3d0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (synce4l-1.0.0.tar.gz) = b97656a50ee4cabdaddde166c2b74b16ebca339defb69e265c5222198c6d469af4e30328c3af47dcbe916f8474f04369e49f5fe98feb509cf7bb41e69e5d429b +SHA512 (synce4l-1.1.0.tar.gz) = d13418f9d229d3b335cf60f4f7a00bb21850d17c3d4f6486e0e13ce7ce6e2435f697b08e69a33980561d34d403148fb40e648eceb2c0b56a5841366d200fd650 diff --git a/synce4l-32bit.patch b/synce4l-32bit.patch deleted file mode 100644 index 8c1ff6e..0000000 --- a/synce4l-32bit.patch +++ /dev/null @@ -1,50 +0,0 @@ -commit 11cc3508d4b7594e2a429000d162b3582d242c20 -Author: Miroslav Lichvar -Date: Mon Nov 6 14:10:42 2023 +0100 - - Fix printf formats for 32-bit archs - - Signed-off-by: Miroslav Lichvar - -diff --git a/config.c b/config.c -index 56fcbbd..723ff84 100644 ---- a/config.c -+++ b/config.c -@@ -21,6 +21,7 @@ - */ - #include - #include -+#include - #include - #include - #include -@@ -767,7 +768,7 @@ config_get_u64(struct config *cfg, const char *section, const char *option) - pr_err("bug: config option %s type mismatch!", option); - exit(-1); - } -- pr_debug("config item %s.%s is %lu (0x%lx)", section, option, -+ pr_debug("config item %s.%s is %"PRIu64" (0x%"PRIx64")", section, option, - ci->val.u64, ci->val.u64); - return ci->val.u64; - } -diff --git a/nl_dpll.c b/nl_dpll.c -index f343de6..4dee01b 100644 ---- a/nl_dpll.c -+++ b/nl_dpll.c -@@ -8,6 +8,7 @@ - #include - #include - #include -+#include - #include - #include "nl_dpll.h" - #include "print.h" -@@ -118,7 +119,7 @@ int nl_dpll_device_id_get(struct nl_sock *sk, struct sk_arg *arg, - pr_err("%s: failed to send request", __func__); - goto msg_free; - } -- pr_debug("DEVICE_ID_GET request sent dpll id: %lu %s, ret:%d", -+ pr_debug("DEVICE_ID_GET request sent dpll id: %"PRIu64" %s, ret:%d", - clock_id, module_name, ret); - - arg->err = 0; diff --git a/synce4l-ccwarns.patch b/synce4l-ccwarns.patch new file mode 100644 index 0000000..0b6ac2b --- /dev/null +++ b/synce4l-ccwarns.patch @@ -0,0 +1,90 @@ +commit b8089eabc28d665cba462c29aabdb159f0f153a6 +Author: Miroslav Lichvar +Date: Tue May 28 13:38:13 2024 +0200 + + Fix more compiler warnings + + Fix the following warnings observed when -O2 and -D_FORTIFY_SOURCE=2 are + added to CFLAGS. + + synce_dev.c: In function ‘rebuild_inputs_prio’: + synce_dev.c:610:28: warning: ‘best_c_idx’ may be used uninitialized [-Wmaybe-uninitialized] + 610 | all[best_c_idx] = NULL; + | ^ + synce_dev.c:582:39: note: ‘best_c_idx’ was declared here + 582 | int i = 0, prio_count = 0, j, best_c_idx, ret; + | ^~~~~~~~~~ + + synce_manager.c: In function ‘synce_manager_server_thread’: + synce_manager.c:260:9: warning: ‘strncpy’ specified bound 108 equals destination size [-Wstringop-truncation] + 260 | strncpy(server.sun_path, synce_clock_get_socket_path(clk), + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 261 | sizeof(server.sun_path)); + | ~~~~~~~~~~~~~~~~~~~~~~~~ + + synce_manager.c:343:20: warning: ‘ret’ may be used uninitialized [-Wmaybe-uninitialized] + 343 | if (!ret) + | ^ + synce_manager.c:241:26: note: ‘ret’ was declared here + 241 | int tlv_num = 0, ret, i, resp_len, bytes_read; + | ^~~ + + synce_manager.c: In function ‘synce_manager_server_thread’: + synce_manager.c:346:25: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] + 346 | write(new_socket, response, resp_len); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Signed-off-by: Miroslav Lichvar + +diff --git a/synce_dev.c b/synce_dev.c +index fc784ed..5e2bbb9 100644 +--- a/synce_dev.c ++++ b/synce_dev.c +@@ -579,7 +579,7 @@ static bool source_invalid(struct synce_clock_source *c) + int rebuild_inputs_prio(struct synce_dev *dev) + { + struct synce_clock_source *c, *best_c, **all, **prioritized; +- int i = 0, prio_count = 0, j, best_c_idx, ret; ++ int i = 0, prio_count = 0, j, best_c_idx = 0, ret; + uint32_t prio; + + all = calloc(dev->num_clock_sources, sizeof(*all)); +diff --git a/synce_manager.c b/synce_manager.c +index b9ba08d..598ef7e 100644 +--- a/synce_manager.c ++++ b/synce_manager.c +@@ -257,8 +257,8 @@ static void *synce_manager_server_thread(void *arg) + } + + server.sun_family = AF_UNIX; +- strncpy(server.sun_path, synce_clock_get_socket_path(clk), +- sizeof(server.sun_path)); ++ snprintf(server.sun_path, sizeof(server.sun_path), "%s", ++ synce_clock_get_socket_path(clk)); + + if (bind(server_fd, (struct sockaddr *)&server, sizeof(server)) < 0) { + pr_err("%s Bind failed", __func__); +@@ -289,10 +289,12 @@ static void *synce_manager_server_thread(void *arg) + bytes_read = recv(new_socket, command, MAX_COMMAND_SIZE, 0); + if (bytes_read <= 0) { + synce_manager_generate_err_tlv(&err_tlv, "NULL command"); ++ ret = -1; + goto return_response; + } else if (bytes_read > MAX_COMMAND_SIZE) { + synce_manager_generate_err_tlv(&err_tlv, + "Command size exceeds MAX_COMMAND_SIZE"); ++ ret = -1; + goto return_response; + } + ret = synce_manager_parse_input(command, bytes_read, &tlv_array, +@@ -340,8 +342,8 @@ return_response: + if (tlv_array) + free((void *)tlv_array); + +- if (!ret) +- write(new_socket, response, resp_len); ++ if (!ret && write(new_socket, response, resp_len) != resp_len) ++ ret = -1; + close(new_socket); + } + diff --git a/synce4l.spec b/synce4l.spec index 0634638..60276eb 100644 --- a/synce4l.spec +++ b/synce4l.spec @@ -1,5 +1,5 @@ Name: synce4l -Version: 1.0.0 +Version: 1.1.0 Release: 2%{?dist} Summary: SyncE implementation for Linux @@ -8,8 +8,8 @@ URL: https://github.com/intel/synce4l Source0: https://github.com/intel/synce4l/archive/%{version}/synce4l-%{version}.tar.gz Source1: synce4l.service -# Fix building on 32-bit archs -Patch1: synce4l-32bit.patch +# Fix compiler warnings to avoid build failures with -Werror +Patch1: synce4l-ccwarns.patch BuildRequires: gcc make systemd BuildRequires: libnl3-devel