Lines Matching +full:open +full:- +full:source

4  * Redistribution and use in source and binary forms, with or without
7 * 1. Redistributions of source code must retain the above copyright
26 #include "atf-c/utils.h"
40 #include <atf-c.h>
42 #include "atf-c/detail/dynstr.h"
107 const int fd = open(name, O_RDONLY); in atf_utils_cat_file()
108 ATF_REQUIRE_MSG(fd != -1, "Cannot open %s", name); in atf_utils_cat_file()
113 while ((count = read(fd, buffer, sizeof(buffer) - 1)) > 0) { in atf_utils_cat_file()
148 const int fd = open(name, O_RDONLY); in atf_utils_compare_file()
149 ATF_REQUIRE_MSG(fd != -1, "Cannot open %s", name); in atf_utils_compare_file()
162 remaining -= count; in atf_utils_compare_file()
171 * \param source Path to the source file.
174 atf_utils_copy_file(const char *source, const char *destination) in atf_utils_copy_file() argument
176 const int input = open(source, O_RDONLY); in atf_utils_copy_file()
177 ATF_REQUIRE_MSG(input != -1, "Failed to open source file during " in atf_utils_copy_file()
178 "copy (%s)", source); in atf_utils_copy_file()
180 const int output = open(destination, O_WRONLY | O_CREAT | O_TRUNC, 0777); in atf_utils_copy_file()
181 ATF_REQUIRE_MSG(output != -1, "Failed to open destination file during " in atf_utils_copy_file()
189 ATF_REQUIRE_MSG(length != -1, "Failed to read from %s during copy", source); in atf_utils_copy_file()
192 ATF_REQUIRE_MSG(fstat(input, &sb) != -1, in atf_utils_copy_file()
193 "Failed to stat source file %s during copy", source); in atf_utils_copy_file()
194 ATF_REQUIRE_MSG(fchmod(output, sb.st_mode) != -1, in atf_utils_copy_file()
219 const int fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); in atf_utils_create_file()
220 ATF_REQUIRE_MSG(fd != -1, "Cannot create file %s", name); in atf_utils_create_file()
222 atf_dynstr_length(&formatted)) != -1); in atf_utils_create_file()
237 if (ret == -1) { in atf_utils_file_exists()
258 if (pid == -1) in atf_utils_fork()
284 /** Frees an dynamically-allocated "argv" array.
286 * \param argv A dynamically-allocated array of dynamically-allocated
319 ATF_REQUIRE((fd = open(file, O_RDONLY)) != -1); in atf_utils_grep_file()
382 ATF_REQUIRE(cnt != -1); in atf_utils_readline()
407 const int new_fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); in atf_utils_redirect()
408 if (new_fd == -1) in atf_utils_redirect()
411 if (dup2(new_fd, target_fd) == -1) in atf_utils_redirect()
429 ATF_REQUIRE(waitpid(pid, &status, 0) != -1); in atf_utils_wait()
464 ATF_REQUIRE(unlink(atf_dynstr_cstring(&out_name)) != -1); in atf_utils_wait()
465 ATF_REQUIRE(unlink(atf_dynstr_cstring(&err_name)) != -1); in atf_utils_wait()