*/
#include "includes.h"
-RCSID("$OpenBSD: tildexpand.c,v 1.10 2001/01/21 19:06:01 markus Exp $");
+RCSID("$OpenBSD: tildexpand.c,v 1.13 2002/06/23 03:25:50 deraadt Exp $");
#include "xmalloc.h"
#include "log.h"
+#include "tildexpand.h"
/*
* Expands tildes in the file name. Returns data allocated by xmalloc.
if (len > MAXPATHLEN)
fatal("Home directory too long (%d > %d", len-1, MAXPATHLEN-1);
expanded = xmalloc(len);
- snprintf(expanded, len, "%s/%s", pw->pw_dir, cp + 1);
+ snprintf(expanded, len, "%s%s%s", pw->pw_dir,
+ strcmp(pw->pw_dir, "/") ? "/" : "", cp + 1);
return expanded;
}