File: 0013-report-error-on-unrecognized-parameters.patch

package info (click to toggle)
xrootconsole 1%3A0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 576 kB
  • sloc: ansic: 6,693; makefile: 61; sh: 44
file content (27 lines) | stat: -rw-r--r-- 810 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From: Julien Viard de Galbert <julien@vdg.blogsite.org>
Date: Thu, 25 May 2017 13:22:09 +0200
Subject: Report error on Unrecognized parameters
Debian-Bug: 858420

Note:
 - This assume parameters starting with dash cannot be the console file name

---
 main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/main.c b/main.c
index e9178b4..faae1d9 100644
--- a/main.c
+++ b/main.c
@@ -545,6 +545,10 @@ void init_options(char **argv, InitOptions *io) {
             fprintf(stderr, "xrootconsole %s\n%s", XROOTCONSOLE_VERSION,USAGE);
             exit(EXIT_SUCCESS);
         }
+        else if (*argv[0] == '-') {
+            fprintf(stderr, "Unrecognized parameter '%s'. Exiting.\n", *argv);
+            exit(EXIT_FAILURE);
+        }
         else {
             io->console_name = *argv;
         }