use dd ifs=$n count=1 ... rather than less-portable head -c$n
authorJim Meyering <meyering@redhat.com>
Wed, 14 May 2008 15:20:42 +0000 (17:20 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 14 May 2008 15:20:42 +0000 (17:20 +0200)
* build-aux/mktempd (rand_bytes): head's -cN option is not accepted
by Solaris 10's /bin/head or by the one from HP-UX 11.x.
Reported in http://sourceforge.net/forum/message.php?msg_id=4960334
via Collin Lasse.

ChangeLog
build-aux/mktempd

index f809215..32e1a87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-14  Jim Meyering  <meyering@redhat.com>
+
+       use dd ifs=$n count=1 ... rather than less-portable head -c$n
+       * build-aux/mktempd (rand_bytes): head's -cN option is not accepted
+       by Solaris 10's /bin/head or by the one from HP-UX 11.x.
+       Reported in http://sourceforge.net/forum/message.php?msg_id=4960334
+       via Collin Lasse.
+
 2008-05-14  Eric Blake  <ebb9@byu.net>
 
        Avoid quadratic growth in gl_LIBSOURCES.
index 7ac914b..5bee3f0 100755 (executable)
@@ -44,7 +44,7 @@ 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.
-    head -c$n "$dev_rand" | tr -c $chars 01234567$chars$chars$chars
+    dd ibs=$n count=1 if="$dev_rand" | tr -c $chars 01234567$chars$chars$chars
     return
   fi