Module Name:    src
Committed By:   rillig
Date:           Sat May 13 06:36:33 UTC 2023

Modified Files:
        src/usr.bin/indent: args.c

Log Message:
indent: don't try to read from the file '(null)/.indent.pro'


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/indent/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.73 src/usr.bin/indent/args.c:1.74
--- src/usr.bin/indent/args.c:1.73	Fri Jan 20 00:24:25 2023
+++ src/usr.bin/indent/args.c	Sat May 13 06:36:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.73 2023/01/20 00:24:25 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.74 2023/05/13 06:36:33 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.73 2023/01/20 00:24:25 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.74 2023/05/13 06:36:33 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -303,8 +303,11 @@ load_profiles(const char *profile_name)
     if (profile_name != NULL)
 	load_profile(profile_name, true);
     else {
-	snprintf(fname, sizeof(fname), "%s/.indent.pro", getenv("HOME"));
-	load_profile(fname, false);
+	const char *home = getenv("HOME");
+	if (home != NULL) {
+	    snprintf(fname, sizeof(fname), "%s/.indent.pro", home);
+	    load_profile(fname, false);
+	}
     }
     load_profile(".indent.pro", false);
 }

Reply via email to