diff options
author | kevlo <kevlo@FreeBSD.org> | 2010-12-08 10:27:07 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2010-12-08 10:27:07 +0000 |
commit | 94551f8622197b7a0cbce550a9d6a732be223df7 (patch) | |
tree | 12d50de8aedb34ade6e75905df109c6ee2b6c9ac /usr.sbin | |
parent | 9bce36c38edb4c76d8a66373ae3ff0d0cc8bd32a (diff) | |
download | FreeBSD-src-94551f8622197b7a0cbce550a9d6a732be223df7.zip FreeBSD-src-94551f8622197b7a0cbce550a9d6a732be223df7.tar.gz |
Close fd in initattr() and showattr().
Reviewed by: rwatson
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/extattrctl/extattrctl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.sbin/extattrctl/extattrctl.c b/usr.sbin/extattrctl/extattrctl.c index 1929f79..377d3ba 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); } |