ippool: Fix build errors found by clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
Khem Raj 2017-08-26 11:35:15 -07:00 committed by Joe MacDonald
parent 54684b2b17
commit cc19bced6a
4 changed files with 124 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From e4e0aae139b6489dc582fd14e54e562126482ce2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 26 Aug 2017 07:23:53 -0700
Subject: [PATCH 1/3] read() returns ssize_t
Fixes
usl_fd.c:284:10: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
if (nb < 0) {
~~ ^ ~
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
usl/usl_fd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usl/usl_fd.c b/usl/usl_fd.c
index 3b7a813..04ba48c 100644
--- a/usl/usl_fd.c
+++ b/usl/usl_fd.c
@@ -280,7 +280,7 @@ size_t usl_fd_read(int fd, void *buf, size_t count)
char *ptr = buf;
for (chars_read = 0; chars_read < count; ) {
- size_t nb = read(fd, ptr, count - chars_read);
+ ssize_t nb = read(fd, ptr, count - chars_read);
if (nb < 0) {
if (errno == EINTR)
continue;
--
2.14.1

View File

@ -0,0 +1,31 @@
From cf25576428903168cd41b183fb1ca9c2b7e2666e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 26 Aug 2017 07:28:10 -0700
Subject: [PATCH 2/3] Mark first element of a string as null
Fixes
cli_lib.c:427:20: error: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Werror,-Wnon-literal-null-conversion]
values[arg] = '\0';
^~~~
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
cli/cli_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cli/cli_lib.c b/cli/cli_lib.c
index 41a0b06..e4d2fd5 100644
--- a/cli/cli_lib.c
+++ b/cli/cli_lib.c
@@ -424,7 +424,7 @@ int cli_find_args(int argc, char *argv[], struct cli_node *cmd, struct cli_node
if (arg_string[1] == '\0') {
/* no arg value - only allowed for string args */
if (node->arg->parser == cli_arg_parse_string) {
- values[arg] = '\0';
+ *values[arg] = '\0';
} else {
result = -EINVAL;
break;
--
2.14.1

View File

@ -0,0 +1,58 @@
From 994d9575374d3cdb34b1b0f70c3c53ae76fe578e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 26 Aug 2017 07:41:05 -0700
Subject: [PATCH 3/3] cli: Mark return of strtol as long int
strtol does not return unsigned long
error: taking the absolute value of unsigned type 'unsigned long' has no effect [-Werror,-Wabsolute-value]
if ((*endp == '\0') && (labs(tmp) < 32768)) {
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
cli/cli_lib.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cli/cli_lib.c b/cli/cli_lib.c
index e4d2fd5..5f487dc 100644
--- a/cli/cli_lib.c
+++ b/cli/cli_lib.c
@@ -522,7 +522,7 @@ int cli_arg_parse_int32(struct cli_node *arg, const char *val, void *result)
int cli_arg_parse_int16(struct cli_node *arg, const char *val, void *result)
{
int16_t *intval = result;
- unsigned long tmp;
+ long tmp;
char *endp;
int ret = 0;
@@ -539,7 +539,7 @@ int cli_arg_parse_int16(struct cli_node *arg, const char *val, void *result)
int cli_arg_parse_int8(struct cli_node *arg, const char *val, void *result)
{
int8_t *intval = result;
- unsigned long tmp;
+ long tmp;
char *endp;
int ret = 0;
@@ -573,7 +573,7 @@ int cli_arg_parse_uint32(struct cli_node *arg, const char *val, void *result)
int cli_arg_parse_uint16(struct cli_node *arg, const char *val, void *result)
{
uint16_t *intval = result;
- unsigned long tmp;
+ long tmp;
char *endp;
int ret = 0;
@@ -590,7 +590,7 @@ int cli_arg_parse_uint16(struct cli_node *arg, const char *val, void *result)
int cli_arg_parse_uint8(struct cli_node *arg, const char *val, void *result)
{
uint8_t *intval = result;
- unsigned long tmp;
+ long tmp;
char *endp;
int ret = 0;
--
2.14.1

View File

@ -21,7 +21,10 @@ SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-$
file://makefile-add-ldflags.patch \
file://0001-usl_timer-Check-for-return-value-of-write-API.patch \
file://0001-Respect-flags-from-env.patch \
"
file://0001-read-returns-ssize_t.patch \
file://0002-Mark-first-element-of-a-string-as-null.patch \
file://0003-cli-Mark-return-of-strtol-as-long-int.patch \
"
SRC_URI_append_libc-musl = "\
file://0002-link-with-libtirpc.patch \
file://0003-musl-fixes.patch \