Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Avoid trying to close a file descriptor that was never opened
Matthew Seaman committed 13 years ago
commit e65f729de5f35f7ac7cf122a7407c32b5d474e7f
parent 7afe682
1 file changed +3 -4
modified libpkg/pkg_elf.c
@@ -261,10 +261,9 @@ analyse_elf(struct pkg *pkg, const char *fpath,
	if (lstat(fpath, &sb) != 0)
		pkg_emit_errno("fstat() failed for %s", fpath);
	/* ignore empty files and non regular files */
-
	if (sb.st_size == 0 || !S_ISREG(sb.st_mode)) {
-
		ret = EPKG_END; /* Empty file: no results */
-
		goto cleanup;
-
	}
+
	if (sb.st_size == 0 || !S_ISREG(sb.st_mode))
+
		return (EPKG_END); /* Empty file or sym-link: no results */
+

	if ((fd = open(fpath, O_RDONLY, 0)) < 0) {
		return (EPKG_FATAL);
	}