[libvirt PATCH 05/19] commandhelper: Consolidate argument parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 tests/commandhelper.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 2be121ce2c..a964420d81 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -56,6 +56,7 @@ int main(int argc, char **argv) {
     size_t buflen[3] = {0, 0, 0};
     char c;
     bool daemonize_check = false;
+    bool close_stdin = false;
     size_t daemonize_retries = 3;
     char buf[1024];
     ssize_t got;
@@ -72,6 +73,8 @@ int main(int argc, char **argv) {
             goto cleanup;
         } else if (STREQ(argv[i], "--check-daemonize")) {
             daemonize_check = true;
+        } else if (STREQ(argv[i], "--close-stdin")) {
+            close_stdin = true;
         }
     }
 
@@ -139,7 +142,7 @@ int main(int argc, char **argv) {
 
     fprintf(log, "UMASK:%04o\n", umask(0));
 
-    if (argc > 1 && STREQ(argv[1], "--close-stdin")) {
+    if (close_stdin) {
         if (freopen("/dev/null", "r", stdin) != stdin)
             goto cleanup;
         usleep(100*1000);
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux