commit 3db478829c602faeb9b507c17433c977c953b7b6
parent dcf7ef8ff794f26d8b38ffbb90ddb9647b8aa059
Author: Christos Margiolis <christos@margiolis.net>
Date: Fri, 1 Apr 2022 23:17:10 +0300
fix empty stdin bug
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/nfy.c b/nfy.c
@@ -101,6 +101,11 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (isatty(STDIN_FILENO)) {
+ warnx("stdin is empty");
+ return (0);
+ }
+
/* detach from tty */
if ((pid = fork()) < 0)
err(1, "fork");