From ee35eb7aa15505be53d6c190103f9a7c53a93a7a Mon Sep 17 00:00:00 2001 From: Jordan Sissel Date: Fri, 23 Feb 2007 18:41:12 +0000 Subject: [PATCH] Make cu/tip handle when $HOME is not set in the environment. Approved by: philip Submitted by: ale PR: bin/108775 --- usr.bin/tip/tip/value.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/tip/tip/value.c b/usr.bin/tip/tip/value.c index 45ee7ceb12d..b6cf5c2a441 100644 --- a/usr.bin/tip/tip/value.c +++ b/usr.bin/tip/tip/value.c @@ -74,7 +74,11 @@ vinit(void) * Read the .tiprc file in the HOME directory * for sets */ - if (strlen(value(HOME)) + sizeof("/.tiprc") > sizeof(file)) { + cp = value(HOME); + if (cp == NULL) { + (void)fprintf(stderr, + "$HOME not set. Skipping check for ~/.tiprc\n"); + } else if (strlen(cp) + sizeof("/.tiprc") > sizeof(file)) { (void)fprintf(stderr, "Home directory path too long: %s\n", value(HOME)); } else {