diff --git a/include/extern.h b/include/extern.h index eafc34c92..64026008e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 5.0 extern.h $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1523 $ */ +/* NetHack 5.0 extern.h $NHDT-Date: 1778886716 2026/05/15 15:11:56 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.1558 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -693,7 +693,8 @@ extern void free_mgivenname(struct monst *) NONNULLARG1; extern void new_oname(struct obj *, int) NONNULLARG1; extern void free_oname(struct obj *) NONNULLARG1; extern const char *safe_oname(struct obj *) NONNULLARG1; -extern struct monst *christen_monst(struct monst *, const char *) NONNULLARG1; +extern struct monst *christen_monst(struct monst *, const char *) NONNULL + NONNULLARG1; extern struct obj *oname(struct obj *, const char *, unsigned) NONNULLPTRS; extern boolean objtyp_is_callable(int); extern int name_ok(struct obj *); diff --git a/src/options.c b/src/options.c index f5d24b1b1..0bb1b4b29 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 5.0 options.c $NHDT-Date: 1737556914 2025/01/22 06:41:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.753 $ */ +/* NetHack 5.0 options.c $NHDT-Date: 1778886716 2026/05/15 15:11:56 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.782 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -558,6 +558,7 @@ parseoptions( got_match = FALSE; if (allopt[i].pfx) { + assert(allopt[i].name != NULL); if (str_start_is(opts, allopt[i].name, TRUE)) { matchidx = i; got_match = pfx_match = TRUE; diff --git a/sys/unix/unixunix.c b/sys/unix/unixunix.c index d614f3278..55c173004 100644 --- a/sys/unix/unixunix.c +++ b/sys/unix/unixunix.c @@ -1,4 +1,4 @@ -/* NetHack 5.0 unixunix.c $NHDT-Date: 1711213894 2024/03/23 17:11:34 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.43 $ */ +/* NetHack 5.0 unixunix.c $NHDT-Date: 1778886716 2026/05/15 15:11:56 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.48 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -370,6 +370,9 @@ int child(int wt) { int f; +#ifdef CHDIR + const char *home = getenv("HOME"); +#endif suspend_nhwindows((char *) 0); /* also calls end_screen() */ #ifdef _M_UNIX @@ -382,7 +385,8 @@ child(int wt) (void) setgid(getgid()); (void) setuid(getuid()); #ifdef CHDIR - (void) chdir(getenv("HOME")); + if (home) + (void) chdir(home); #endif return 1; }