From 2b6fa0839f705b7c144ea4df0310307f76d2ad45 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Fri, 20 Apr 2018 17:19:52 +0200 Subject: [PATCH] no more strlen(xxx) == 0. Fixes #292 --- minissdpd/daemonize.c | 4 ++-- miniupnpc-libevent/miniupnpc-libevent.c | 2 +- miniupnpd/daemonize.c | 4 ++-- miniupnpd/options.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/minissdpd/daemonize.c b/minissdpd/daemonize.c index a490a9e..4c5909d 100644 --- a/minissdpd/daemonize.c +++ b/minissdpd/daemonize.c @@ -67,7 +67,7 @@ writepidfile(const char * fname, int pid) int pidstringlen; int pidfile; - if(!fname || (strlen(fname) == 0)) + if(!fname || fname[0] == '\0') return -1; if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0) @@ -102,7 +102,7 @@ checkforrunning(const char * fname) int pidfile; pid_t pid; - if(!fname || (strlen(fname) == 0)) + if(!fname || fname[0] == '\0') return -1; if( (pidfile = open(fname, O_RDONLY)) < 0) diff --git a/miniupnpc-libevent/miniupnpc-libevent.c b/miniupnpc-libevent/miniupnpc-libevent.c index 460e5f2..a454cb4 100644 --- a/miniupnpc-libevent/miniupnpc-libevent.c +++ b/miniupnpc-libevent/miniupnpc-libevent.c @@ -412,7 +412,7 @@ static void upnpc_desc_received(struct evhttp_request * req, void * pvoid) d->control_cif_url, d->cif_service_type); if((d->cif_service_type == NULL) - || (strlen(d->cif_service_type) == 0) + || (d->cif_service_type[0] == '\0') || (!COMPARE(d->cif_service_type, "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:"))) { d->parent->ready_cb(UPNPC_ERR_NOT_IGD, d->parent, d, d->parent->cb_data); } else { diff --git a/miniupnpd/daemonize.c b/miniupnpd/daemonize.c index a490a9e..4c5909d 100644 --- a/miniupnpd/daemonize.c +++ b/miniupnpd/daemonize.c @@ -67,7 +67,7 @@ writepidfile(const char * fname, int pid) int pidstringlen; int pidfile; - if(!fname || (strlen(fname) == 0)) + if(!fname || fname[0] == '\0') return -1; if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0) @@ -102,7 +102,7 @@ checkforrunning(const char * fname) int pidfile; pid_t pid; - if(!fname || (strlen(fname) == 0)) + if(!fname || fname[0] == '\0') return -1; if( (pidfile = open(fname, O_RDONLY)) < 0) diff --git a/miniupnpd/options.c b/miniupnpd/options.c index 5062c2c..9448ba8 100644 --- a/miniupnpd/options.c +++ b/miniupnpd/options.c @@ -2,7 +2,7 @@ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * author: Ryan Wagoner - * (c) 2006-2014 Thomas Bernard + * (c) 2006-2018 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -106,7 +106,7 @@ readoptionsfile(const char * fname) size_t len; void *tmp; - if(!fname || (strlen(fname) == 0)) + if(!fname || (fname[0] == '\0')) return -1; memset(buffer, 0, sizeof(buffer));