http_server: detect disk-full when writing PID file
commitd947cb91cf9dbd65d48e497b2605b124571f77ad
authorEric Wong <BOFH@YHBT.net>
Sat, 1 Oct 2022 22:57:40 +0000 (1 22:57 +0000)
committerEric Wong <bofh@yhbt.net>
Tue, 4 Oct 2022 00:53:06 +0000 (4 00:53 +0000)
tree08514b7a6af0287f140c356ef63859fed282dff2
parente7e9e2fdf40e566a50f98d0f421892d696d6681e
http_server: detect disk-full when writing PID file

While unlikely, it's possible for write(2) to return a truncated
value or ENOSPC error if the device is full when writing a tiny
PID file.

As optimism has no place in engineering, use IO#write instead of
IO#syswrite since the former will retry on truncation and raise
a exception on ENOSPC.
lib/unicorn/http_server.rb