From 11afce24ad85f7413582a2918a049466d62cda91 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 27 Feb 2024 12:22:13 -0800 Subject: die on failed freopen --- slock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slock.c b/slock.c index edd4440..6f63d3d 100644 --- a/slock.c +++ b/slock.c @@ -405,7 +405,8 @@ main(int argc, char **argv) { case -1: die("slock: fork failed: %s\n", strerror(errno)); case 0: - freopen("/dev/null", "w", stdout); + if (!freopen("/dev/null", "w", stdout)) + die("slock: freopen: %s\n", strerror(errno)); break; default: if (opt_pid) -- cgit v1.2.3-70-g09d2