From c7fb30fbe481bbf10887132d7ac9496107e896a0 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 14 Aug 1998 06:26:58 +0000 Subject: [PATCH] /usr/sbin/spkrtest and /usr/sbin/vidfont (aka kbdmap) use very predictable /tmp files (static prefix + process number) which are overwritten blindly, and follow links. These workarounds change it from a process number to a very random (9999 with tons of decimal places) number. PR: 7565 Submitted by: Thomas Stromberg --- usr.sbin/kbdmap/kbdmap.pl | 5 +++-- usr.sbin/spkrtest/spkrtest.pl | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/kbdmap/kbdmap.pl b/usr.sbin/kbdmap/kbdmap.pl index 66180da7ee52..9d46c1fd0cc9 100644 --- a/usr.sbin/kbdmap/kbdmap.pl +++ b/usr.sbin/kbdmap/kbdmap.pl @@ -26,7 +26,7 @@ # # kbdmap/vidfont - front end for syscons # -# $Id: kbdmap.pl,v 1.6 1997/02/22 16:06:02 peter Exp $ +# $Id: kbdmap.pl,v 1.7 1997/05/19 07:30:45 jkh Exp $ # simple test if syscons works @@ -229,8 +229,9 @@ sub menu_read { } sub dialog { + srand; local(@argv) = @_; - local($tmp) = "/tmp/_kbd_lang$$"; + local($tmp) = "/tmp/_kbd_lang" . rand(9999); $dialog = "/usr/bin/dialog \\ --clear \\ diff --git a/usr.sbin/spkrtest/spkrtest.pl b/usr.sbin/spkrtest/spkrtest.pl index fa00caae37ea..0af081a54004 100644 --- a/usr.sbin/spkrtest/spkrtest.pl +++ b/usr.sbin/spkrtest/spkrtest.pl @@ -32,7 +32,7 @@ # # NOTE for iso-* (latin1) fonts: use TERM=cons25-iso8859-1 # -# $Id$ +# $Id: spkrtest.pl,v 1.5 1997/02/22 16:13:37 peter Exp $ $title = qq{ reveille -- Reveille @@ -93,7 +93,8 @@ foreach (sort keys %title) { push(@checklist, ($_, $title{$_}, 'OFF')); } -$tmp = ($ENV{'TMP'} || "/tmp") . "/_spkrtest$$"; +srand; +$tmp = ($ENV{'TMP'} || "/tmp") . "/_spkrtest" . rand(9999); if (!open(SPEAKER, "> $speaker")) { warn "You have no write access to $speaker or the speaker device is not " .