mirror of https://github.com/vitalif/e2fsprogs
libblkid: add error checking for rename() while saving the blkid cache
Addresses-Coverity-Id: #1049141 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>maint-test
parent
a8307ab8cc
commit
0d719bad86
|
@ -136,7 +136,7 @@ int blkid_flush_cache(blkid_cache cache)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
if (opened != filename) {
|
if (opened != filename) {
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
unlink(opened);
|
(void) unlink(opened);
|
||||||
DBG(DEBUG_SAVE,
|
DBG(DEBUG_SAVE,
|
||||||
printf("unlinked temp cache %s\n", opened));
|
printf("unlinked temp cache %s\n", opened));
|
||||||
} else {
|
} else {
|
||||||
|
@ -149,7 +149,8 @@ int blkid_flush_cache(blkid_cache cache)
|
||||||
link(filename, backup);
|
link(filename, backup);
|
||||||
free(backup);
|
free(backup);
|
||||||
}
|
}
|
||||||
rename(opened, filename);
|
if (rename(opened, filename) < 0)
|
||||||
|
(void) unlink(opened);
|
||||||
DBG(DEBUG_SAVE,
|
DBG(DEBUG_SAVE,
|
||||||
printf("moved temp cache %s\n", opened));
|
printf("moved temp cache %s\n", opened));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue