aboutsummaryrefslogtreecommitdiff
path: root/query-prefixes
diff options
context:
space:
mode:
authorDavid Timber <dxdt@dev.snart.me>2024-10-28 13:36:35 +0100
committerDavid Timber <dxdt@dev.snart.me>2024-10-28 13:55:53 +0100
commitca08936a767d443571cec1d973a197d2cd692ead (patch)
tree6cb6d720e2583c3e0841723a2f47538de17d5590 /query-prefixes
parent0ba39be479ec7b5ea432031c4df125edc5bb9f6b (diff)
Fix race condition, fix doc ...stable
- Remove use of named pipe which was a bad design in the first place - Fix rare case where netcat's error slipping processing the last AS - Doc: fix factual errors, add some more info
Diffstat (limited to 'query-prefixes')
-rwxr-xr-xquery-prefixes14
1 files changed, 3 insertions, 11 deletions
diff --git a/query-prefixes b/query-prefixes
index dc1bff6..746dc01 100755
--- a/query-prefixes
+++ b/query-prefixes
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
. common.sh
PIPE_NAME="$$.fifo.tmp"
@@ -14,7 +15,6 @@ read_aslist () {
while read asn
do
- echo ${asn} >&3
echo ${Q_PREFIX}${asn}
done
}
@@ -30,13 +30,5 @@ output_filter () {
}
-mkfifo "$PIPE_NAME" || exit 1
-grep -Eoi 'AS[0-9]+' |
- read_aslist 3> "$PIPE_NAME" |
- open_db |
- extract_answer |
- output_filter \
- 3< "$PIPE_NAME" &
-rm "$PIPE_NAME"
-
-wait
+set -o pipefail
+read_aslist | open_db | extract_answer | output_filter