clang -cc1 -cc1 -triple amd64-unknown-openbsd7.4 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name instr.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/games/cribbage/obj -resource-dir /usr/local/llvm16/lib/clang/16 -internal-isystem /usr/local/llvm16/lib/clang/16/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/games/cribbage/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fcf-protection=branch -fno-jump-tables -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/scan/2024-01-11-140451-98009-1 -x c /usr/src/games/cribbage/instr.c
| 1 |  | 
| 2 |  | 
| 3 |   | 
| 4 |  | 
| 5 |   | 
| 6 |   | 
| 7 |   | 
| 8 |   | 
| 9 |   | 
| 10 |   | 
| 11 |   | 
| 12 |   | 
| 13 |   | 
| 14 |   | 
| 15 |   | 
| 16 |   | 
| 17 |   | 
| 18 |   | 
| 19 |   | 
| 20 |   | 
| 21 |   | 
| 22 |   | 
| 23 |   | 
| 24 |   | 
| 25 |   | 
| 26 |   | 
| 27 |   | 
| 28 |   | 
| 29 |   | 
| 30 |   | 
| 31 |   | 
| 32 |   | 
| 33 | #include <sys/wait.h> | 
| 34 |   | 
| 35 | #include <err.h> | 
| 36 | #include <errno.h> | 
| 37 | #include <fcntl.h> | 
| 38 | #include <paths.h> | 
| 39 | #include <stdlib.h> | 
| 40 | #include <unistd.h> | 
| 41 |   | 
| 42 | #include "pathnames.h" | 
| 43 |   | 
| 44 | void | 
| 45 | instructions(void) | 
| 46 | { | 
| 47 | 	int pstat; | 
| 48 | 	int fd; | 
| 49 | 	pid_t pid; | 
| 50 | 	const char *pager; | 
| 51 |   | 
| 52 | 	if ((fd = open(_PATH_INSTR, O_RDONLY)) == - 1) | 
 | 1  | Assuming the condition is false |  |  
  | 
 |  | 
| 53 | 		errx(1, "can't open %s", _PATH_INSTR); | 
| 54 |   | 
| 55 | 	switch (pid = vfork()) { | 
 | 3  |  | Control jumps to 'case 0:'  at line 58 |  |  
  | 
| 56 | 	case -1: | 
| 57 | 		err(1, "vfork"); | 
| 58 | 	case 0: | 
| 59 | 		if (!isatty(1)) | 
 | 4  |  | This function call is prohibited after a successful vfork |  
  | 
| 60 | 			pager = "/bin/cat"; | 
| 61 | 		else { | 
| 62 | 			if (!(pager = getenv("PAGER")) || (*pager == 0)) | 
| 63 | 				pager = _PATH_MORE; | 
| 64 | 		} | 
| 65 | 		if (dup2(fd, 0) == -1) | 
| 66 | 			err(1, "dup2"); | 
| 67 | 		execl(_PATH_BSHELL, "sh", "-c", pager, (char *)NULL); | 
| 68 | 		err(1, "exec sh -c %s", pager); | 
| 69 | 	default: | 
| 70 | 		do { | 
| 71 | 			pid = waitpid(pid, &pstat, 0); | 
| 72 | 		} while (pid == -1 && errno == EINTR); | 
| 73 | 		close(fd); | 
| 74 | 		if (pid == -1 || WEXITSTATUS(pstat)) | 
| 75 | 			exit(1); | 
| 76 | 		break; | 
| 77 | 	} | 
| 78 | } |