Date: Wed, 8 Dec 2010 10:27:07 +0000 (UTC) From: Kevin Lo <kevlo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r216292 - head/usr.sbin/extattrctl Message-ID: <201012081027.oB8AR7bj097974@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevlo Date: Wed Dec 8 10:27:07 2010 New Revision: 216292 URL: http://svn.freebsd.org/changeset/base/216292 Log: Close fd in initattr() and showattr(). Reviewed by: rwatson Modified: head/usr.sbin/extattrctl/extattrctl.c Modified: head/usr.sbin/extattrctl/extattrctl.c ============================================================================== --- head/usr.sbin/extattrctl/extattrctl.c Wed Dec 8 08:57:37 2010 (r216291) +++ head/usr.sbin/extattrctl/extattrctl.c Wed Dec 8 10:27:07 2010 (r216292) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012081027.oB8AR7bj097974>