summaryrefslogtreecommitdiff
path: root/usr.sbin/extattrctl
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2001-11-15 22:50:06 +0000
committerRobert Watson <rwatson@FreeBSD.org>2001-11-15 22:50:06 +0000
commit8970738b86ed89d28c4b342d5f1ed5405a52b8b7 (patch)
tree1b5bf56730306f744df378389ce15f2172f95395 /usr.sbin/extattrctl
parent21a7a9aeb63c77a7003a61d2606194c43230aff1 (diff)
downloadsrc-test-8970738b86ed89d28c4b342d5f1ed5405a52b8b7.tar.gz
src-test-8970738b86ed89d28c4b342d5f1ed5405a52b8b7.zip
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
Notes
Notes: svn path=/head/; revision=86428
Diffstat (limited to 'usr.sbin/extattrctl')
-rw-r--r--usr.sbin/extattrctl/extattrctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/extattrctl/extattrctl.c b/usr.sbin/extattrctl/extattrctl.c
index c5b60552aae88..19df04b20ba7d 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) {