[lvm-devel] [PATCH 25/29] Check for unlink result

Zdenek Kabelac zkabelac at redhat.com
Thu Nov 25 10:55:29 UTC 2010


Even if we intentionally wish to silently ignore any error from
unlink in this place - it might be still good idea to put at least
a debug message to get the reason for failure.

Test makes static analyzer happier about checked unlink result.

Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---
 lib/format_text/archiver.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c
index 3ace628..e0efafb 100644
--- a/lib/format_text/archiver.c
+++ b/lib/format_text/archiver.c
@@ -261,7 +261,9 @@ int backup_remove(struct cmd_context *cmd, const char *vg_name)
 	/*
 	 * Let this fail silently.
 	 */
-	unlink(path);
+	if (unlink(path))
+		log_debug("Unlink %s failed: %s", path, strerror(errno));
+
 	return 1;
 }
 
-- 
1.7.3.2




More information about the lvm-devel mailing list