diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-10-26 20:02:57 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-10-26 20:02:57 +0000 |
commit | cdb3f1837ff5e63fdacc235d16b1162274159d79 (patch) | |
tree | ba8ce0d161025dde430220b3cd6a5669f8efaff2 /games | |
parent | 8deb8394464151d582d21e03bd5ab95ed54350da (diff) |
prefer $LOGNAME to $USER. Fix strncpy() usage.
Diffstat (limited to 'games')
-rw-r--r-- | games/larn/main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/games/larn/main.c b/games/larn/main.c index e80b154908b..ae8c469bf19 100644 --- a/games/larn/main.c +++ b/games/larn/main.c @@ -62,8 +62,8 @@ main(argc,argv) if (pwe=getpwuid(getuid())) /* can we get it from /etc/passwd? */ ptr = pwe->pw_name; else - if ((ptr = getenv("USER")) == 0) - if ((ptr = getenv("LOGNAME")) == 0) + if ((ptr = getenv("LOGNAME")) == 0) + if ((ptr = getenv("USER")) == 0) { noone: write(2, "Can't find your logname. Who Are You?\n",39); exit(); @@ -145,7 +145,9 @@ main(argc,argv) write(1,cmdhelp,sizeof(cmdhelp)); exit(); case 'o': /* specify a .larnopts filename */ - strncpy(optsfile,argv[i]+2,127); break; + strncpy(optsfile,argv[i]+2,127); + optsfile[127] = '\0'; + break; default: printf("Unknown option <%s>\n",argv[i]); exit(); }; |