File: local.vbladed-check-params.patch

package info (click to toggle)
vblade 25-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 336 kB
  • sloc: ansic: 1,310; sh: 633; makefile: 60
file content (24 lines) | stat: -rw-r--r-- 686 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Subject: Used for avoiding calling vbladed without arguments,
 and while at it, add the usage command line.
Author: David Martínez Moreno <ender@debian.org>
Date: 2005-10-28
Forwarded: no
Last-Update: 2007-04-08

--- a/vbladed
+++ b/vbladed
@@ -3,4 +3,14 @@
 # output is directed to syslogd
 #
 
+# Although logging goes to syslog, let's going to
+# protect ourselves against the most common way or
+# calling vbladed: without arguments.  While at it, we guard
+# ourselves against wrong number of parameters.
+if [ $# -lt 4 ]
+then
+    echo "usage: ./vblade <shelf> <slot> <ethn> <device>" >&2
+    exit 1
+fi
+
 sh -c "`dirname $0`/vblade $* < /dev/null 2>&1 | logger -t vbladed" &