]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: check for NULL in blkid_flush_cache() [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 12:39:49 +0000 (13:39 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 12:39:49 +0000 (13:39 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/save.c

index 9c1ab467eac4e0b2f0b288cd7bc0b1f4b12cb9a7..f0008ae53e6c470ede80589779e7685c3e06696c 100644 (file)
@@ -74,9 +74,11 @@ int blkid_flush_cache(blkid_cache cache)
 
        filename = cache->bic_filename ? cache->bic_filename :
                                         blkid_get_cache_filename(NULL);
+       if (!filename)
+               return -BLKID_ERR_PARAM;
 
-       if (filename && strncmp(filename,
-               BLKID_RUNTIME_DIR "/", sizeof(BLKID_RUNTIME_DIR)) == 0) {
+       if (strncmp(filename,
+           BLKID_RUNTIME_DIR "/", sizeof(BLKID_RUNTIME_DIR)) == 0) {
 
                /* default destination, create the directory if necessary */
                if (stat(BLKID_RUNTIME_DIR, &st) && errno == ENOENT) {