소스 검색

fix: close descriptor if failed to attach stream

David Marec 1 주 전
부모
커밋
520ae25c11
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      kqueue/kq_timer.c

+ 2 - 1
kqueue/kq_timer.c

@@ -103,7 +103,8 @@ int main(int argc, char *argv[])
 
 	fd = fdopen(fdx, "w");
 	if (fd == NULL) {
-		warn("fopen() failure");
+		warn("fdopen() failure");
+		close(fdx);
 		return EXIT_FAILURE;
 	}