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.
This commit is contained in:
Alex Smith
2017-09-01 17:43:04 +01:00
parent 7bb4cb1b1e
commit 1d4b6aae40

View File

@@ -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;