diff --git a/handlers/borg.in b/handlers/borg.in
index df6b2233c3a0453973c79e2bfd435c1efc690456..eecd2c72fe716dcbdd49e144e7e36c2be1204d77 100644
--- a/handlers/borg.in
+++ b/handlers/borg.in
@@ -175,7 +175,8 @@ debug "$nice $execstr"
 
 if [ $test = 0 ]; then
    output=`$nice su -c "$execstr" 2>&1`
-   if [ $? = 0 ]; then
+   ret=$?
+   if [ $ret = 0 ]; then
       debug $output
       info "Successfully finished backing up source."
    elif [ $ret = 1 ]; then