[10733] in Athena Bugs
Re: decmips 7.4H: get_message: fix to read $HOME
daemon@ATHENA.MIT.EDU (Calvin Clark)
Wed Aug 4 19:11:44 1993
Date: Wed, 4 Aug 93 19:11:38 -0400
From: Calvin Clark <ckclark@MIT.EDU>
To: bugs@Athena.MIT.EDU
In-Reply-To: "[10634] in Athena Bugs"
The change I submitted in bugs [10634] won't work on a vax, because
getenv() doesn't have a prototype and NULL isn't defined <string.h> (an
ANSI thing.) Here is a better patch:
*** /source/athena/athena.bin/gms/check_viewable.c Mon Oct 3 16:53:12 1988
--- check_viewable.c Wed Aug 4 19:02:59 1993
***************
*** 1,7 ****
/* This file is part of the Project Athena Global Message System.
* Created by: Mark W. Eichin <eichin@athena.mit.edu>
! * $Source: /mit/eichin/projects/GMS/src/RCS/check_viewable.c,v $
! * $Author: eichin $
*
* Copyright (c) 1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
--- 1,7 ----
/* This file is part of the Project Athena Global Message System.
* Created by: Mark W. Eichin <eichin@athena.mit.edu>
! * $Source: /afs/athena.mit.edu/user/c/k/ckclark/home/sipb/src/gms/RCS/check_viewable.c,v $
! * $Author: ckclark $
*
* Copyright (c) 1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
***************
*** 9,19 ****
*/
#include <mit-copyright.h>
#ifndef lint
! static char rcsid_check_viewable_c[] = "$Header: check_viewable.c,v 1.4 88/10/03 16:52:52 eichin Exp $";
#endif lint
#include "globalmessage.h"
! #include <strings.h>
#include <sys/types.h>
#include <sys/file.h>
#include <pwd.h>
--- 9,20 ----
*/
#include <mit-copyright.h>
#ifndef lint
! static char rcsid_check_viewable_c[] = "$Header: /afs/athena.mit.edu/user/c/k/ckclark/home/sipb/src/gms/RCS/check_viewable.c,v 1.3 1993/08/04 23:02:35 ckclark Exp $";
#endif lint
#include "globalmessage.h"
! #include <stdio.h>
! #include <string.h>
#include <sys/types.h>
#include <sys/file.h>
#include <pwd.h>
***************
*** 43,56 ****
struct passwd *pw;
char *userdir;
! pw = getpwuid(getuid());
!
! if(pw) {
! userdir = pw->pw_dir;
! } else {
! /* couldn't check user's file, probably better send it. */
! free(usertfilename);
! return(0);
}
usertfilename = malloc(GMS_USERFILE_NAME_LEN+strlen(userdir)+1);
--- 44,61 ----
struct passwd *pw;
char *userdir;
! userdir = (char *) getenv ("HOME");
!
! if (userdir == NULL) {
! pw = getpwuid(getuid());
!
! if(pw) {
! userdir = pw->pw_dir;
! } else {
! /* couldn't check user's file, probably better send it. */
! free(usertfilename);
! return(0);
! }
}
usertfilename = malloc(GMS_USERFILE_NAME_LEN+strlen(userdir)+1);