]> git.tuebingen.mpg.de Git - dss.git/blobdiff - dss.c
Fix return value of remove_oldest_snapshot().
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index cee49d68885d88abc8af991647905fd6c91f354d..27c14b6720d47fc88721c7bd25765affc791daa9 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -367,6 +367,7 @@ static int remove_outdated_snapshot(struct snapshot_list *sl)
 
 static int remove_oldest_snapshot(struct snapshot_list *sl)
 {
+       int ret;
        struct snapshot *s = get_oldest_snapshot(sl);
 
        if (!s) /* no snapshot found */
@@ -374,7 +375,10 @@ static int remove_oldest_snapshot(struct snapshot_list *sl)
        DSS_INFO_LOG("oldest snapshot: %s\n", s->name);
        if (snapshot_is_being_created(s))
                return 0;
-       return pre_remove_hook(s, "oldest");
+       ret = pre_remove_hook(s, "oldest");
+       if (ret < 0)
+               return ret;
+       return 1;
 }
 
 static int rename_incomplete_snapshot(int64_t start)
@@ -568,7 +572,10 @@ static int handle_rm_exit(int status)
                snapshot_removal_status = HS_READY;
                return -E_BAD_EXIT_CODE;
        }
-       snapshot_removal_status = HS_SUCCESS;
+       if (conf.post_remove_hook_given)
+               snapshot_removal_status = HS_SUCCESS;
+       else
+               snapshot_removal_status = HS_READY;
        return 1;
 }