diff options
author | Karel Zak | 2012-01-31 12:55:36 +0100 |
---|---|---|
committer | Karel Zak | 2012-01-31 12:55:36 +0100 |
commit | c461b8d8c4d6848e00fb991d75cb53927876e964 (patch) | |
tree | dd5de09e6b9bb6e18216f9611671ccb0c462c8a6 /libblkid/src/save.c | |
parent | chfn: fix use-after-free [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-c461b8d8c4d6848e00fb991d75cb53927876e964.tar.gz kernel-qcow2-util-linux-c461b8d8c4d6848e00fb991d75cb53927876e964.tar.xz kernel-qcow2-util-linux-c461b8d8c4d6848e00fb991d75cb53927876e964.zip |
libblkid: check rename() return value [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/save.c')
-rw-r--r-- | libblkid/src/save.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libblkid/src/save.c b/libblkid/src/save.c index 7673ab42e..9c1ab467e 100644 --- a/libblkid/src/save.c +++ b/libblkid/src/save.c @@ -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)); + } } } |