[PATCH] mtree should not output size if the file is not a regular file
Xin Li
delphij at delphij.net
Mon Sep 9 21:35:02 UTC 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hi,
I think it doesn't make sense to emit size information for non-regular
files like directories, symlinks, etc. although both our and NetBSD's
mtree would emit it.
Comments?
Index: usr.sbin/mtree/create.c
===================================================================
- --- usr.sbin/mtree/create.c (revision 255424)
+++ usr.sbin/mtree/create.c (working copy)
@@ -208,7 +208,7 @@ statf(int indent, FTSENT *p)
output(indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS);
if (keys & F_NLINK && p->fts_statp->st_nlink != 1)
output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink);
- - if (keys & F_SIZE)
+ if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode))
output(indent, &offset, "size=%jd",
(intmax_t)p->fts_statp->st_size);
if (keys & F_TIME)
Cheers,
- --
Xin LI <delphij at delphij.net> https://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.21 (FreeBSD)
iQEcBAEBCgAGBQJSLj8GAAoJEG80Jeu8UPuzfr4H/RU/qxwVIBAdiXzaD7CvPnCr
3fl+wMIaugYYyZCOWXu1cW4NS8eq5PGPtkJyXCjxGjnyjIpJgZ9XWxZMzdNR4ID0
qLuDOStThE3jjQ/11vx4G4qwsd7iB/BE0O8dfpf68VQu50b40IRl6nDRfHrUETuZ
wYFT+tbm6EiJlNif6Y9XNFJhdAuow3oPEexx6fxv5AUaC9ZeyoSZQdCJoDcfOsXm
gEnB1IJiS5hRXckimvTrq8pjnfj+u6oTAj9U4klAx0yDk6VZuZPIWaYOnPZJr7BR
rVuiRbLFnc2yIPyFFq7y3guqCJpRvOwRuOF/N5vj3qSCYJXmIasXkUjUM6hsxA0=
=hteB
-----END PGP SIGNATURE-----
More information about the freebsd-current
mailing list