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.
#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;