no more strlen(xxx) == 0.

Fixes #292
This commit is contained in:
Thomas Bernard 2018-04-20 17:19:52 +02:00
parent 9d569438d3
commit 2b6fa0839f
4 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ writepidfile(const char * fname, int pid)
int pidstringlen; int pidstringlen;
int pidfile; int pidfile;
if(!fname || (strlen(fname) == 0)) if(!fname || fname[0] == '\0')
return -1; return -1;
if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0) if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0)
@ -102,7 +102,7 @@ checkforrunning(const char * fname)
int pidfile; int pidfile;
pid_t pid; pid_t pid;
if(!fname || (strlen(fname) == 0)) if(!fname || fname[0] == '\0')
return -1; return -1;
if( (pidfile = open(fname, O_RDONLY)) < 0) if( (pidfile = open(fname, O_RDONLY)) < 0)

View File

@ -412,7 +412,7 @@ static void upnpc_desc_received(struct evhttp_request * req, void * pvoid)
d->control_cif_url, d->cif_service_type); d->control_cif_url, d->cif_service_type);
if((d->cif_service_type == NULL) 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:"))) { || (!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); d->parent->ready_cb(UPNPC_ERR_NOT_IGD, d->parent, d, d->parent->cb_data);
} else { } else {

View File

@ -67,7 +67,7 @@ writepidfile(const char * fname, int pid)
int pidstringlen; int pidstringlen;
int pidfile; int pidfile;
if(!fname || (strlen(fname) == 0)) if(!fname || fname[0] == '\0')
return -1; return -1;
if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0) if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0)
@ -102,7 +102,7 @@ checkforrunning(const char * fname)
int pidfile; int pidfile;
pid_t pid; pid_t pid;
if(!fname || (strlen(fname) == 0)) if(!fname || fname[0] == '\0')
return -1; return -1;
if( (pidfile = open(fname, O_RDONLY)) < 0) if( (pidfile = open(fname, O_RDONLY)) < 0)

View File

@ -2,7 +2,7 @@
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* author: Ryan Wagoner * author: Ryan Wagoner
* (c) 2006-2014 Thomas Bernard * (c) 2006-2018 Thomas Bernard
* This software is subject to the conditions detailed * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -106,7 +106,7 @@ readoptionsfile(const char * fname)
size_t len; size_t len;
void *tmp; void *tmp;
if(!fname || (strlen(fname) == 0)) if(!fname || (fname[0] == '\0'))
return -1; return -1;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));