From: Alex Smith Date: Fri, 1 Sep 2017 16:43:04 +0000 (+0100) Subject: Fix error behaviour when perm is missing X-Git-Tag: NetHack-3.6.1_RC01~413 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d4b6aae40eebb1c454260546763a571b8366bad;p=nethack 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. --- 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;