X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=build-aux%2Fmktempd;h=ab3cf14ef467e91d5b6f515f2bd80d86b67b81fa;hb=8a8ef57118fa76ee06d57715f997332a8d3488ec;hp=5bee3f0c76d4125130e0051d61998f9caa817970;hpb=49161ce7902821ef24a9e30b16dc87147c24da65;p=gnulib.git diff --git a/build-aux/mktempd b/build-aux/mktempd index 5bee3f0c7..ab3cf14ef 100755 --- a/build-aux/mktempd +++ b/build-aux/mktempd @@ -1,7 +1,7 @@ #!/bin/sh # Create a temporary directory, much like mktemp -d does. -# Copyright (C) 2007-2008 Free Software Foundation, Inc. +# Copyright (C) 2007-2012 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,7 +44,8 @@ rand_bytes() dev_rand=/dev/urandom if test -r "$dev_rand"; then # Note: 256-length($chars) == 194; 3 copies of $chars is 186 + 8 = 194. - dd ibs=$n count=1 if="$dev_rand" | tr -c $chars 01234567$chars$chars$chars + dd ibs=$n count=1 if="$dev_rand" 2>/dev/null \ + | tr -c $chars 01234567$chars$chars$chars return fi @@ -114,7 +115,9 @@ mktempd() base_template=`echo "$template"|sed 's/XX*$//'` # Calculate how many X's we've just removed. - nx=`expr length "$template" - length "$base_template"` + template_length=`echo "$template" | wc -c` + nx=`echo "$base_template" | wc -c` + nx=`expr $template_length - $nx` err= i=1