libc - fix handling of temporary file used by hash(3)
authorYONETANI Tomokazu <y0netan1@dragonflybsd.org>
Thu, 3 Feb 2011 05:29:48 +0000 (14:29 +0900)
committerYONETANI Tomokazu <y0netan1@dragonflybsd.org>
Fri, 4 Feb 2011 03:37:58 +0000 (12:37 +0900)
commite90a7c45c3303ed54c0fde732b2ba32dc80ffd9b
tree5a10a95e9c82c489b4f52e72a367878e8ee2ddac
parentc50f05d240ae32e508f742e1458397340483af0c
libc - fix handling of temporary file used by hash(3)

This fixes applications using DB_HASH, such as tsort, to unexpectedly
try to open a temporary file in the current directory and fail if it
has no write permission there.

Obtained from FreeBSD, r190485, by delphij:

  db/btree/bt_open.c: check return value of snprintf() and return value
  if the result is truncated.

  db/hash/hash_page.c: use the same way to create temporary file as
  bt_open.c; check snprintf() return value.

  Obtained from:  OpenBSD
lib/libc/db/btree/bt_open.c
lib/libc/db/hash/hash_page.c