From e0596715dcf57cd431394d923d63dfe5aaf49749 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 2 Jan 2018 15:17:32 +0000 Subject: [PATCH] zstd: fix crash when not overwriting existing files This fixes the following crash: $ touch exists $ programs/zstd -r examples/ -o exists zstd: exists already exists; not overwritten Segmentation fault (core dumped) * programs/fileio.c (FIO_compressMultipleFilenames): Handle the case where we're not overwriting the destination. Reported at https://bugzilla.redhat.com/1530049 --- programs/fileio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/programs/fileio.c b/programs/fileio.c index b57ce14d2..f9c9087ba 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -951,10 +951,14 @@ int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFile if (outFileName != NULL) { unsigned u; ress.dstFile = FIO_openDstFile(outFileName); - for (u=0; u