OpenBSD is unable to write to /dev/zero

https://github.com/facebook/zstd/pull/1124 fixes an issue with GNU/Hurd
being unable to write to /dev/zero. Implemented fix is writing to
/dev/random instead.

On OpenBSD a regular user is unable to write to /dev/random because of
permissions set on this device. Result is failing a regression test.

Proposed solution should work for all platforms.
dev
Björn Ketelaars 2018-06-30 13:01:58 +02:00
parent b5207aadfa
commit 276988f794
1 changed files with 6 additions and 2 deletions

View File

@ -48,6 +48,8 @@ fileRoundTripTest() {
$DIFF -q tmp.md5.1 tmp.md5.2 $DIFF -q tmp.md5.1 tmp.md5.2
} }
UNAME=$(uname)
isTerminal=false isTerminal=false
if [ -t 0 ] && [ -t 1 ] if [ -t 0 ] && [ -t 1 ]
then then
@ -56,7 +58,10 @@ fi
isWindows=false isWindows=false
INTOVOID="/dev/null" INTOVOID="/dev/null"
DEVDEVICE="/dev/random" case "$UNAME" in
OpenBSD) DEVDEVICE="/dev/zero" ;;
*) DEVDEVICE="/dev/random" ;;
esac
case "$OS" in case "$OS" in
Windows*) Windows*)
isWindows=true isWindows=true
@ -65,7 +70,6 @@ case "$OS" in
;; ;;
esac esac
UNAME=$(uname)
case "$UNAME" in case "$UNAME" in
Darwin) MD5SUM="md5 -r" ;; Darwin) MD5SUM="md5 -r" ;;
FreeBSD) MD5SUM="gmd5sum" ;; FreeBSD) MD5SUM="gmd5sum" ;;