From a69bdc0ef63343373773995f7e87d11a29ed4259 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 16 Sep 2023 16:48:04 -0400 Subject: sbopkglint: refactor gzip detection. --- sbopkglint | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sbopkglint') diff --git a/sbopkglint b/sbopkglint index fd458c4..2e86174 100755 --- a/sbopkglint +++ b/sbopkglint @@ -584,6 +584,12 @@ find_warnfiles() { rm -f $output } +# return true if the file is gzipped, otherwise false. +# faster than using file(1). +is_gzipped() { + [ "$( hexdump -n 2 -e '"%2x"' "$1" )" = '8b1f' ] +} + # N.B. these need to match the template (and they do) TMP=${TMP:-/tmp/SBo} OUTPUT=${OUTPUT:-/tmp} -- cgit v1.2.3