From 2773184d92f52d93deb7f04e27f4ea377ee7ecd4 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Tue, 28 Nov 2000 05:53:41 +0000
Subject: [PATCH] Handle ~~ in tab comp without segfaulting =)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@339 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 files.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/files.c b/files.c
index 1f72d3f9..3cc2dfc6 100644
--- a/files.c
+++ b/files.c
@@ -534,8 +534,9 @@ char *real_dir_from_tilde (char *buf)
     int fd, i, status, searchctr = 1;
 
     if (buf[0] == '~') {
-
-	if (buf[1] == '/') {
+	if (buf[1] == '~')
+	    goto abort;		/* Handle ~~ without segfaulting =) */
+	else if (buf[1] == '/') {
 	    if (getenv("HOME") != NULL) {
 		dirtmp = nmalloc(strlen(buf) + 2 + strlen(getenv("HOME")));
 
-- 
GitLab