summaryrefslogtreecommitdiff
path: root/usr.sbin/extattrctl
diff options
context:
space:
mode:
authorKevin Lo <kevlo@FreeBSD.org>2010-12-08 10:27:07 +0000
committerKevin Lo <kevlo@FreeBSD.org>2010-12-08 10:27:07 +0000
commitc10bc05389b7ebbdc20894e771506f10576dfe54 (patch)
tree12d50de8aedb34ade6e75905df109c6ee2b6c9ac /usr.sbin/extattrctl
parent60a7e0c3cbe5f700ebd14f447a8ca07bf264899d (diff)
downloadsrc-test-c10bc05389b7ebbdc20894e771506f10576dfe54.tar.gz
src-test-c10bc05389b7ebbdc20894e771506f10576dfe54.zip
Close fd in initattr() and showattr().
Reviewed by: rwatson
Notes
Notes: svn path=/head/; revision=216292
Diffstat (limited to 'usr.sbin/extattrctl')
-rw-r--r--usr.sbin/extattrctl/extattrctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.sbin/extattrctl/extattrctl.c b/usr.sbin/extattrctl/extattrctl.c
index 1929f796f4f9a..377d3baef9ac1 100644
--- a/usr.sbin/extattrctl/extattrctl.c
+++ b/usr.sbin/extattrctl/extattrctl.c
@@ -144,9 +144,11 @@ initattr(int argc, char *argv[])
if (error == -1) {
perror(argv[1]);
unlink(argv[1]);
+ close(i);
return (-1);
}
+ close(i);
return (0);
}
@@ -168,21 +170,25 @@ showattr(int argc, char *argv[])
i = read(fd, &uef, sizeof(uef));
if (i == -1) {
perror(argv[0]);
+ close(fd);
return (-1);
}
if (i != sizeof(uef)) {
fprintf(stderr, "%s: invalid file header\n", argv[0]);
+ close(fd);
return (-1);
}
if (uef.uef_magic != UFS_EXTATTR_MAGIC) {
fprintf(stderr, "%s: bad magic\n", argv[0]);
+ close(fd);
return (-1);
}
printf("%s: version %d, size %d\n", argv[0], uef.uef_version,
uef.uef_size);
+ close(fd);
return (0);
}