Skip to contentSkip to conversation

Fix return value of persistent_filters_dump if rename failed

PATCH New Nir Soffer 1 participant 1 message Oct 17, 2013 1 message not in the archive

lore
Share & tools
lore

Nir Soffer

author
#1 lore raw

PATCH 1/1 Fix return value of persistent_filters_dump if rename failed

In reply to a message not in the archive
Quoted 1 line

From eeae04cf523e0c3050d5c686b29fb53316d3c760 Mon Sep 17 00:00:00 2001

From: Nir Soffer <[email protected]>
Date: Thu, 17 Oct 2013 21:18:06 +0300
Subject: [PATCH] Fix return value of persistent_filters_dump if rename failed

---
 lib/filters/filter-persistent.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/filters/filter-persistent.c +3 -1
index 14a3480..f068369 100644
@@ -253,9 +253,11 @@ static int _persistent_filter_dump(struct dev_filter *f, int merge_existing)
    if (lvm_fclose(fp, tmp_file))
        goto_out;
 
-   if (rename(tmp_file, pf->file))
+   if (rename(tmp_file, pf->file)) {
        log_error("%s: rename to %s failed: %s", tmp_file, pf->file,
              strerror(errno));
+       goto out;
+   }
 
    r = 1;
 
Signature · 1 line
1.8.3.1