File dd_rescue-u-emptyout-segfault.diff of Package dd_rescue

commit 250bf8baf8d7a59d09a8ef48d966019972d3ee5a
Author: Kurt Garloff <kurt@garloff.de>
Date:   Mon Aug 12 15:19:09 2024 +0200

    Prevent segfault with -u and empty output filename.
    
    Signed-off-by: Kurt Garloff <kurt@garloff.de>

diff --git a/dd_rescue.c b/dd_rescue.c
index 92f81d0..2d32084 100644
--- a/dd_rescue.c
+++ b/dd_rescue.c
@@ -1466,7 +1466,7 @@ int real_cleanup(opt_t *op, fstate_t *fst, progress_t *prg,
 		copyxattr(op->iname, op->oname);
 		copytimes(op->iname, op->oname);
 	}
-	if (op->rmvtrim)
+	if (op->rmvtrim && op->oname)
 		remove_and_trim(op->oname, op);
 	LISTFOREACH(ofiles, of) {
 		if (op->preserve) {
openSUSE Build Service is sponsored by