]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: check rename() return value [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 11:55:36 +0000 (12:55 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 11:55:36 +0000 (12:55 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/save.c

index 7673ab42e74ba47e2345d4ee547850d513ec3916..9c1ab467eac4e0b2f0b288cd7bc0b1f4b12cb9a7 100644 (file)
@@ -162,9 +162,15 @@ int blkid_flush_cache(blkid_cache cache)
                                }
                                free(backup);
                        }
-                       rename(opened, filename);
-                       DBG(DEBUG_SAVE,
-                           printf("moved temp cache %s\n", opened));
+                       if (rename(opened, filename)) {
+                               ret = errno;
+                               DBG(DEBUG_SAVE,
+                                       printf("can't rename %s to %s\n",
+                                               opened, filename));
+                       } else {
+                               DBG(DEBUG_SAVE,
+                                   printf("moved temp cache %s\n", opened));
+                       }
                }
        }