[libnss]: fix compiling issue under gcc 8 (#4414)

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
lguohan 2020-04-11 20:43:50 -07:00 committed by GitHub
parent 606db589b8
commit 195a0a7bf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From d8300dca720dc17e19d39efa3abbe3c3e5600262 Mon Sep 17 00:00:00 2001
From: Guohan Lu <lguohan@gmail.com>
Date: Wed, 5 Feb 2020 07:25:13 +0000
Subject: [PATCH] fix compiling warning about token dereference
---
nss_tacplus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nss_tacplus.c b/nss_tacplus.c
index 3ff3c35..7feeda6 100644
--- a/nss_tacplus.c
+++ b/nss_tacplus.c
@@ -87,7 +87,7 @@ static int parse_tac_server(char *srv_buf)
token = strsep(&srv_buf, delim);
while(token) {
- if('\0' != token) {
+ if('\0' != token[0]) {
if(!strncmp(token, "server=", 7)) {
struct addrinfo hints, *server;
int rv;
@@ -161,7 +161,7 @@ static int parse_user_priv(char *buf)
token = strsep(&buf, delim);
while(token) {
- if('\0' != token) {
+ if('\0' != token[0]) {
if(!strncmp(token, "user_priv=", 10)) {
priv = (int)strtoul(token + 10, NULL, 0);
if(priv > MAX_TACACS_USER_PRIV || priv < MIN_TACACS_USER_PRIV)
--
2.17.1

View File

@ -23,6 +23,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
git $(GIT_APPLY) ../0003-management-vrf-support.patch
git $(GIT_APPLY) ../0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch
git $(GIT_APPLY) ../0005-libnss-Modify-parsing-of-IP-addr-and-port-number-str.patch
git $(GIT_APPLY) ../0006-fix-compiling-warning-about-token-dereference.patch
dpkg-buildpackage -rfakeroot -b -us -uc
popd