[Olsr-dev] [PATCH v1 07/18] info: improve readability of the 'empty request' check

Ferry Huberts (spam-protected)
Sat Dec 10 18:25:17 CET 2016


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/olsrd_info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index e8bed0d..43170b8 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -809,8 +809,8 @@ static void ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int
   req = skipLeadingWhitespace(req, (size_t*) &rx_count);
   req = skipMultipleSlashes(req, (size_t*) &rx_count);
 
-  if ((req[0] == '\0') //
-      || ((req[0] == '/') && (req[1] == '\0'))) {
+  if (!rx_count //
+      || ((rx_count == 1) && (*req == '/'))) {
     /* empty or '/' */
     send_what = SIW_EVERYTHING;
   } else {
-- 
2.9.3




More information about the Olsr-dev mailing list