]> granicus.if.org Git - nethack/commitdiff
U571 - access denied message
authorcohrs <cohrs>
Sat, 2 Aug 2003 21:39:57 +0000 (21:39 +0000)
committercohrs <cohrs>
Sat, 2 Aug 2003 21:39:57 +0000 (21:39 +0000)
Since only developers know that "13" is EACCES, try to include the text
message.  I'm not 100% sure the ifdefs are complete, but it can be tweaked
as needed.  This was the only common message in files.c that included errno
so it's the only one I changed.  Of course, "13" is only one of several
possible errno values that might reasonably show up here.

doc/fixes34.2
src/files.c

index 90c72210b5057b5836cc501874689e89dc440f1b..2ae5ba3bbfc9769c2bcfd1dd8d1b5acc62c006fb 100644 (file)
@@ -139,6 +139,7 @@ linux: add example use of nroff on recent Linux distros
 linux: use random() by default instead of lrand48()
 OpenBSD: time() prototype and correct default Mail program
 Gnome: compilation problems on Solaris
+unix: better error message for .nethackrc access problems
 
 
 General New Features
index cd1089cf683c656a052c38b6047a9dfeaf03ba74..32e2ab6789051a0435cf75a9e40132495d866e45 100644 (file)
@@ -1553,11 +1553,18 @@ const char *filename;
        }
 # endif
        if (errno != ENOENT) {
-               /* e.g., problems when setuid NetHack can't search home
-                * directory restricted to user */
-               raw_printf("Couldn't open default config file %s (%d).",
-                                       tmp_config, errno);
-               wait_synch();
+           char *details;
+
+           /* e.g., problems when setuid NetHack can't search home
+            * directory restricted to user */
+
+#if defined(POSIX_TYPES) || defined(BSD) || defined(SYSV)
+           if ((details = strerror(errno)) == 0)
+#endif
+               details = "";
+           raw_printf("Couldn't open default config file %s %s(%d).",
+                      tmp_config, details, errno);
+           wait_synch();
        }
 # endif
 #endif