From 1d4b6aae40eebb1c454260546763a571b8366bad Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Fri, 1 Sep 2017 17:43:04 +0100 Subject: [PATCH] Fix error behaviour when perm is missing The previous behaviour was to mention the missing file, but then to try and fail to lock the nonexistent file 10 times, which rather obscured the original cause of the error as it took up so much more room on the screen. This patch also changes the error message. Failure to lock a nonexistent file is almost always the result of a mistake during the install process (e.g. running from the wrong directory, or running without an install). We should give the user a hint about that. --- src/files.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 1c55133cb..970734024 100644 --- a/src/files.c +++ b/src/files.c @@ -1643,8 +1643,9 @@ int retryct; #ifdef USE_FCNTL lockfd = open(filename, O_RDWR); if (lockfd == -1) { - HUP raw_printf("Cannot open file %s. This is a program bug.", + HUP raw_printf("Cannot open file %s. Is NetHack installed correctly?", filename); + return FALSE; } sflock.l_type = F_WRLCK; sflock.l_whence = SEEK_SET;