Skip to content

Commit 195a0a7

Browse files
authored
[libnss]: fix compiling issue under gcc 8 (sonic-net#4414)
Signed-off-by: Guohan Lu <lguohan@gmail.com>
1 parent 606db58 commit 195a0a7

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From d8300dca720dc17e19d39efa3abbe3c3e5600262 Mon Sep 17 00:00:00 2001
2+
From: Guohan Lu <lguohan@gmail.com>
3+
Date: Wed, 5 Feb 2020 07:25:13 +0000
4+
Subject: [PATCH] fix compiling warning about token dereference
5+
6+
---
7+
nss_tacplus.c | 4 ++--
8+
1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+
diff --git a/nss_tacplus.c b/nss_tacplus.c
11+
index 3ff3c35..7feeda6 100644
12+
--- a/nss_tacplus.c
13+
+++ b/nss_tacplus.c
14+
@@ -87,7 +87,7 @@ static int parse_tac_server(char *srv_buf)
15+
16+
token = strsep(&srv_buf, delim);
17+
while(token) {
18+
- if('\0' != token) {
19+
+ if('\0' != token[0]) {
20+
if(!strncmp(token, "server=", 7)) {
21+
struct addrinfo hints, *server;
22+
int rv;
23+
@@ -161,7 +161,7 @@ static int parse_user_priv(char *buf)
24+
25+
token = strsep(&buf, delim);
26+
while(token) {
27+
- if('\0' != token) {
28+
+ if('\0' != token[0]) {
29+
if(!strncmp(token, "user_priv=", 10)) {
30+
priv = (int)strtoul(token + 10, NULL, 0);
31+
if(priv > MAX_TACACS_USER_PRIV || priv < MIN_TACACS_USER_PRIV)
32+
--
33+
2.17.1
34+

src/tacacs/nss/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
2323
git $(GIT_APPLY) ../0003-management-vrf-support.patch
2424
git $(GIT_APPLY) ../0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch
2525
git $(GIT_APPLY) ../0005-libnss-Modify-parsing-of-IP-addr-and-port-number-str.patch
26+
git $(GIT_APPLY) ../0006-fix-compiling-warning-about-token-dereference.patch
2627

2728
dpkg-buildpackage -rfakeroot -b -us -uc
2829
popd

0 commit comments

Comments
 (0)