ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
6f381c
From 76fe0974f62f0a2beb2d3d8e224e80a57c0ebd09 Mon Sep 17 00:00:00 2001
6f381c
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
6f381c
Date: Fri, 4 Oct 2019 16:14:47 +0200
6f381c
Subject: [PATCH] pstore: allow specifying src and dst dirs are arguments
6f381c
6f381c
This makes it much easier to debug the program as a normal user, since we
6f381c
don't need to set up fake input under /sys/fs/pstore/.
6f381c
6f381c
Also, let's make the debug output a bit nicer.
6f381c
6f381c
(cherry picked from commit e05a72d7587ff916a983588f8393af624d330dd0)
6f381c
6f381c
Related: #2158832
6f381c
---
6f381c
 src/pstore/pstore.c | 11 +++++++----
6f381c
 1 file changed, 7 insertions(+), 4 deletions(-)
6f381c
6f381c
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
6f381c
index b0b21dedd4..7353e83a81 100644
6f381c
--- a/src/pstore/pstore.c
6f381c
+++ b/src/pstore/pstore.c
6f381c
@@ -358,15 +358,18 @@ static int run(int argc, char *argv[]) {
6f381c
 
6f381c
         log_open();
6f381c
 
6f381c
-        if (argc > 1)
6f381c
+        if (argc == 3) {
6f381c
+                arg_sourcedir = argv[1];
6f381c
+                arg_archivedir = argv[2];
6f381c
+        } else if (argc > 1)
6f381c
                 return log_error_errno(-EINVAL,
6f381c
-                                       "This program takes no arguments.");
6f381c
+                                       "This program takes zero or two arguments.");
6f381c
 
6f381c
         /* Ignore all parse errors */
6f381c
         (void) parse_config();
6f381c
 
6f381c
-        log_debug("Selected storage '%s'.", pstore_storage_to_string(arg_storage));
6f381c
-        log_debug("Selected Unlink '%d'.", arg_unlink);
6f381c
+        log_debug("Selected storage: %s.", pstore_storage_to_string(arg_storage));
6f381c
+        log_debug("Selected unlink: %s.", yes_no(arg_unlink));
6f381c
 
6f381c
         if (arg_storage == PSTORE_STORAGE_NONE)
6f381c
                 /* Do nothing, intentionally, leaving pstore untouched */