summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtree/spec.c
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>1999-01-12 02:58:23 +0000
committerjkoshy <jkoshy@FreeBSD.org>1999-01-12 02:58:23 +0000
commitc93a7d05cf03dd9930b14d50f3efc2b7693d6a0c (patch)
tree1093b5c1136631fc06015ad6b77db87832152c8d /usr.sbin/mtree/spec.c
parentcdf79e6bf32b91067c032e57abfe26ce17dc7089 (diff)
downloadFreeBSD-src-c93a7d05cf03dd9930b14d50f3efc2b7693d6a0c.zip
FreeBSD-src-c93a7d05cf03dd9930b14d50f3efc2b7693d6a0c.tar.gz
Teach mtree(8) to handle whitespace in filenames. Uses strvis(3).
PR: bin/3246 Submitted by: Eugene M. Kim <astralblue@usa.net> Reviewed by: jkoshy, wollman
Diffstat (limited to 'usr.sbin/mtree/spec.c')
-rw-r--r--usr.sbin/mtree/spec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/mtree/spec.c b/usr.sbin/mtree/spec.c
index 7d7906b..1e9c5fd 100644
--- a/usr.sbin/mtree/spec.c
+++ b/usr.sbin/mtree/spec.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: spec.c,v 1.7 1997/10/01 06:30:02 charnier Exp $";
+ "$Id: spec.c,v 1.8 1998/12/16 04:54:08 imp Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -49,6 +49,7 @@ static const char rcsid[] =
#include <pwd.h>
#include <stdio.h>
#include <unistd.h>
+#include <vis.h>
#include "mtree.h"
#include "extern.h"
@@ -143,10 +144,14 @@ noparent: errx(1, "line %d: no parent node", lineno);
if ((centry = calloc(1, sizeof(NODE) + strlen(p))) == NULL)
errx(1, "calloc");
*centry = ginfo;
- (void)strcpy(centry->name, p);
#define MAGIC "?*["
if (strpbrk(p, MAGIC))
centry->flags |= F_MAGIC;
+ if (strunvis(centry->name, p) == -1) {
+ warnx("filename %s is ill-encoded and literally used",
+ p);
+ strcpy(centry->name, p);
+ }
set(NULL, centry);
if (!root) {
OpenPOWER on IntegriCloud