From e68800a28dfd71fbf2171de8be1e7c8abb1405e3 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Mon, 10 Oct 2016 14:26:29 -0500 Subject: [PATCH 1/2] Fixup stdin-wrapper * Use a more universal shebang. * Use the template feature of mktemp to avoid silly gymnastics. --- stdin-wrapper | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/stdin-wrapper b/stdin-wrapper index 09e9436..0b52f2a 100755 --- a/stdin-wrapper +++ b/stdin-wrapper @@ -1,4 +1,4 @@ -#!/bin/bash -eu +#!/usr/bin/env bash # Author: w0rp # Description: This script implements a wrapper for any program which does not accept @@ -10,11 +10,8 @@ file_extension="$1" shift -temp_file=`mktemp` -mv "$temp_file" "$temp_file$file_extension" -temp_file="$temp_file$file_extension" - -trap "rm $temp_file" EXIT +temp_file=$(mktemp --tmpdir "ale-XXX$file_extension") +trap 'rm $temp_file' EXIT while read -r; do echo "$REPLY" >> "$temp_file" From ad2ee80eb68955f5c0415d0a784edbfcafa23925 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Mon, 10 Oct 2016 15:53:56 -0500 Subject: [PATCH 2/2] More randomness in the wrapper tmpfile --- stdin-wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdin-wrapper b/stdin-wrapper index 0b52f2a..c1758df 100755 --- a/stdin-wrapper +++ b/stdin-wrapper @@ -10,7 +10,7 @@ file_extension="$1" shift -temp_file=$(mktemp --tmpdir "ale-XXX$file_extension") +temp_file=$(mktemp --tmpdir "ale-XXXXXXXXX$file_extension") trap 'rm $temp_file' EXIT while read -r; do