summaryrefslogtreecommitdiffstats
path: root/usr.bin/tip
diff options
context:
space:
mode:
authorjls <jls@FreeBSD.org>2007-02-23 18:41:12 +0000
committerjls <jls@FreeBSD.org>2007-02-23 18:41:12 +0000
commit888dd25b3f4c16afa95f90b76578f976a367f25d (patch)
tree3f497ea240b99493603383db1f34e43140d91765 /usr.bin/tip
parent6a2b82898232618a674ca07021a360fc8649c6a2 (diff)
downloadFreeBSD-src-888dd25b3f4c16afa95f90b76578f976a367f25d.zip
FreeBSD-src-888dd25b3f4c16afa95f90b76578f976a367f25d.tar.gz
Make cu/tip handle when $HOME is not set in the environment.
Approved by: philip Submitted by: ale PR: bin/108775
Diffstat (limited to 'usr.bin/tip')
-rw-r--r--usr.bin/tip/tip/value.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/tip/tip/value.c b/usr.bin/tip/tip/value.c
index 45ee7ce..b6cf5c2 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 {
OpenPOWER on IntegriCloud