diff options
author | phk <phk@FreeBSD.org> | 2003-10-30 12:03:25 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-10-30 12:03:25 +0000 |
commit | 10c0052ec4ac1d18a7c1d6025ce3f9ffb1440cb6 (patch) | |
tree | 5630471086317d8b7d185333d255ae3980608d94 /usr.sbin/mtree/compare.c | |
parent | 3b266c3cbf9a561d5b610513656365deed12d8d4 (diff) | |
download | FreeBSD-src-10c0052ec4ac1d18a7c1d6025ce3f9ffb1440cb6.zip FreeBSD-src-10c0052ec4ac1d18a7c1d6025ce3f9ffb1440cb6.tar.gz |
Use vis(3) to encode/decode the target for symlinks.
Make vis(3) decode errors fatal for both symlink targets and fienames.
Diffstat (limited to 'usr.sbin/mtree/compare.c')
-rw-r--r-- | usr.sbin/mtree/compare.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c index 33683f5..8fad8a4 100644 --- a/usr.sbin/mtree/compare.c +++ b/usr.sbin/mtree/compare.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/stat.h> +#include <vis.h> #include <err.h> #include <errno.h> #include <fcntl.h> @@ -350,11 +351,13 @@ ftype(u_int type) char * rlink(char *name) { - static char lbuf[MAXPATHLEN]; + char tbuf[MAXPATHLEN]; + static char lbuf[MAXPATHLEN * 4]; int len; - if ((len = readlink(name, lbuf, sizeof(lbuf) - 1)) == -1) + if ((len = readlink(name, tbuf, sizeof(tbuf) - 1)) == -1) err(1, "line %d: %s", lineno, name); - lbuf[len] = '\0'; + tbuf[len] = '\0'; + strvis(lbuf, tbuf, VIS_WHITE | VIS_OCTAL); return (lbuf); } |