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