diff options
author | rwatson <rwatson@FreeBSD.org> | 2001-11-15 22:50:06 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2001-11-15 22:50:06 +0000 |
commit | dd8f99d336b510b7401853b6343fca6949e58444 (patch) | |
tree | 1b5bf56730306f744df378389ce15f2172f95395 /usr.sbin/extattrctl | |
parent | ae1274f8d211ea0b3273badf7478d43e90f36d0d (diff) | |
download | FreeBSD-src-dd8f99d336b510b7401853b6343fca6949e58444.zip FreeBSD-src-dd8f99d336b510b7401853b6343fca6949e58444.tar.gz |
o extattrctl initattr, when pre-allocating store for extended attributes,
computed a a chunksize that didn't include the extended attribute
header. This was a non-fatal error, in that it was just writing out
zeros anyway, but did have the effect of not pre-allocating the
right amount of disk space. This fix calculates chunksize to include
the attribute header.
Submitted by: Dale Rahn
Sponsored by: DARPA, UPenn POSSE Project
Obtained from: OpenBSD
Diffstat (limited to 'usr.sbin/extattrctl')
-rw-r--r-- | usr.sbin/extattrctl/extattrctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/extattrctl/extattrctl.c b/usr.sbin/extattrctl/extattrctl.c index c5b60552..19df04b 100644 --- a/usr.sbin/extattrctl/extattrctl.c +++ b/usr.sbin/extattrctl/extattrctl.c @@ -122,16 +122,16 @@ initattr(int argc, char *argv[]) if (write(i, &uef, sizeof(uef)) == -1) error = -1; else if (fs_path) { - zero_buf = (char *) (malloc(uef.uef_size)); + chunksize = sizeof(struct ufs_extattr_header) + + uef.uef_size; + zero_buf = (char *) (malloc(chunksize)); if (zero_buf == NULL) { perror("malloc"); unlink(argv[1]); return (-1); } - memset(zero_buf, 0, uef.uef_size); + memset(zero_buf, 0, chunksize); num_inodes = num_inodes_by_path(fs_path); - chunksize = sizeof(struct ufs_extattr_header) + - uef.uef_size; for (loop = 0; loop < num_inodes; loop++) { error = write(i, zero_buf, chunksize); if (error != chunksize) { |