From e71250d3e93ba0ccb7e333ac56554d7ba23cc139 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Tue, 5 Jan 2021 21:24:34 +0100
Subject: [PATCH] MKV: Warn user when mkvpropedit fails...

---
 src/mkv/write.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mkv/write.c b/src/mkv/write.c
index 9429eba4..fdbab551 100644
--- a/src/mkv/write.c
+++ b/src/mkv/write.c
@@ -66,14 +66,12 @@ mkvpropedit__(const char *const args[])
 
     if ((pid = fork()) == 0) {
         if ((fd = open("/dev/null", O_WRONLY | O_TRUNC)) < 0) {
-            LOG_ERROR("FORK", "Can't to open /dev/null "
-                      "in O_WRONLY O_TRUNC");
+            LOG_ERROR("FORK", "Can't to open /dev/null in O_WRONLY O_TRUNC");
             return false;
         }
 
         if (dup2(fd, 1) < 0) {
-            LOG_ERROR("FORK", "Failed to duplicate "
-                      "/dev/null to stdout");
+            LOG_ERROR("FORK", "Failed to duplicate /dev/null to stdout");
             return false;
         }
 
@@ -89,14 +87,17 @@ mkvpropedit__(const char *const args[])
     else {
         do {
             if (waitpid(pid, &wstatus, WUNTRACED | WCONTINUED) == -1) {
-                LOG_ERROR("FORK", "Failed to wait children: %s",
-                          strerror(errno));
+                LOG_ERROR("FORK", "Failed to wait children: %s", strerror(errno));
                 return false;
             }
         } while (!WIFEXITED(wstatus) && !WIFSIGNALED(wstatus));
 
         if ((status = WEXITSTATUS(wstatus))) {
             LOG_ERROR("FORK", "Children failed with status %d", status);
+            if (status == 2)
+                LOG_ERROR("FORK", "Status 2 with mkvpropedit could means that karas are not valid MKV files");
+            else if (status == 1)
+                LOG_WARN("FORK", "Status 1 on mkvpropedit means that it generated some warnings...");
             return false;
         }
     }
-- 
GitLab