checksrc: detect more kinds of NULL comparisons we avoid

Co-authored-by: Jay Satiro
Closes #8180
This commit is contained in:
Daniel Stenberg 2021-12-25 21:41:14 +01:00
parent acaa79f961
commit 21248e052d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
36 changed files with 87 additions and 87 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -124,12 +124,12 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors)
/* !checksrc! disable BANNEDFUNC 2 */
tempdir = strtok(outdup, PATH_DELIMITERS);
while(tempdir != NULL) {
while(tempdir) {
bool skip = false;
tempdir2 = strtok(NULL, PATH_DELIMITERS);
/* since strtok returns a token for the last word even
if not ending with DIR_CHAR, we need to prune it */
if(tempdir2 != NULL) {
if(tempdir2) {
size_t dlen = strlen(dirbuildup);
if(dlen)
msnprintf(&dirbuildup[dlen], outlen - dlen, "%s%s", DIR_CHAR, tempdir);

View file

@ -280,7 +280,7 @@ int main(int argc, char *argv[])
}
#ifdef __NOVELL_LIBC__
if(getenv("_IN_NETWARE_BASH_") == NULL)
if(!getenv("_IN_NETWARE_BASH_"))
tool_pressanykey();
#endif

View file

@ -100,7 +100,7 @@ int fwrite_xattr(CURL *curl, int fd)
int err = 0;
/* loop through all xattr-curlinfo pairs and abort on a set error */
while(err == 0 && mappings[i].attr != NULL) {
while(err == 0 && mappings[i].attr) {
char *value = NULL;
CURLcode result = curl_easy_getinfo(curl, mappings[i].info, &value);
if(!result && value) {