diff mbox series

[FFmpeg-devel,1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists

Message ID d9391147-7ab5-4047-fc63-ae2c952b22e1@dabe.com
State New
Headers show
Series Make "File exists" exit w/ non-zero status | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch

Commit Message

Dabrien 'Dabe' Murphy July 15, 2024, 12:56 p.m. UTC
---
  fftools/ffmpeg_opt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

-- 2.45.2

Comments

Marth64 July 16, 2024, 4:10 a.m. UTC | #1
Gyan:
> The former is not an error. The user was asked and the application
> behaved as per their reply.
Could it make sense to only return the AVERROR(EEXIST) if -nostdin is
passed (otherwise current behavior)?
I have observed this behavior too and think it's strange only in the
-nostdin case.
Gyan Doshi July 16, 2024, 5:07 a.m. UTC | #2
On 2024-07-16 09:40 am, Marth64 wrote:
> Gyan:
>> The former is not an error. The user was asked and the application
>> behaved as per their reply.
> Could it make sense to only return the AVERROR(EEXIST) if -nostdin is
> passed (otherwise current behavior)?

Agreed.

Regards,
Gyan
diff mbox series

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 2c201c74b2..dddf7c6475 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -604,13 +604,13 @@  int assert_file_overwrite(const char *filename)
                  signal(SIGINT, SIG_DFL);
                  if (!read_yesno()) {
                      av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n");
-                    return AVERROR_EXIT;
+                    return AVERROR(EEXIST);
                  }
                  term_init();
              }
              else {
                  av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
-                return AVERROR_EXIT;
+                return AVERROR(EEXIST);
              }
          }
      }