Blame SOURCES/0004-Fix-microdnf---help-coredump.patch

ace92b
From 1701ad8ccccae6f8867a862e074ca30f6583e69f Mon Sep 17 00:00:00 2001
ace92b
From: Jaroslav Rohel <jrohel@redhat.com>
ace92b
Date: Fri, 23 Aug 2019 12:42:42 +0200
ace92b
Subject: [PATCH] Fix "microdnf --help" coredump
ace92b
ace92b
There was a bug that causes coredump during comand "microdnf --help".
ace92b
The bug was in the code that removes the directory path from argv[0]
ace92b
(in case argv[0] does not contain '/' character).
ace92b
---
ace92b
 dnf/dnf-main.c | 4 ++--
ace92b
 1 file changed, 2 insertions(+), 2 deletions(-)
ace92b
ace92b
diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c
ace92b
index e35ace0..7c71bd0 100644
ace92b
--- a/dnf/dnf-main.c
ace92b
+++ b/dnf/dnf-main.c
ace92b
@@ -298,8 +298,8 @@ main (int   argc,
ace92b
 
ace92b
   if (cmd_name == NULL && show_help)
ace92b
     {
ace92b
-      const char *prg_name = strrchr(argv[0], '/') + 1;
ace92b
-      prg_name = prg_name ? prg_name : argv[0];
ace92b
+      const char *prg_name = strrchr(argv[0], '/');
ace92b
+      prg_name = prg_name ? prg_name + 1 : argv[0];
ace92b
 
ace92b
       g_set_prgname (prg_name);
ace92b
       g_autofree gchar *help = g_option_context_get_help (opt_ctx, TRUE, NULL);
ace92b
-- 
ace92b
2.24.0
ace92b