Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/test_out_file.h # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / test_out_file.h` 22 lines · 1035 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* test_out_file.h: create a test output file (receipt JSON, kernel dump, saved probe data, fake fixture) with mode 0600. 3 * 4 * fopen(path, "w") asks for 0666 and leaves the rest to the umask, so under umask 0 every receipt is world-writable 5 * and anyone on the host can rewrite a result before it is filed (CodeQL cpp/world-writable-file-creation). The user 6 * who runs a test is the user who reads its output: the chip scripts (tools/c5/chip.sh and friends) write and file the 7 * receipts as themselves, and no runner reads them as another user. Otherwise the same as fopen "w": create or 8 * truncate, the path taken as given. */ 9 #ifndef TEST_OUT_FILE_H 10 #define TEST_OUT_FILE_H 11 #include 12 #include 13 #include 14 15 static inline FILE *test_out_open(const char *path) { 16 int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0600); 17 if (fd < 0) return NULL; 18 FILE *f = fdopen(fd, "w"); 19 if (!f) close(fd); 20 return f; 21 } 22 #endif