TEST(chase_symlinks) {
_cleanup_free_ char *result = NULL, *pwd = NULL;
- _cleanup_close_ int pfd = -1;
+ _cleanup_close_ int pfd = -EBADF;
char *temp;
const char *top, *p, *pslash, *q, *qslash;
struct stat st;
r = chase_symlinks(p, NULL, 0, NULL, &pfd);
if (r != -ENOENT && sd_id128_get_machine(NULL) >= 0) {
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
sd_id128_t a, b;
assert_se(pfd >= 0);
TEST(access_fd) {
_cleanup_(rmdir_and_freep) char *p = NULL;
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
const char *a;
a = strjoina(arg_test_dir ?: "/tmp", "/access-fd.XXXXXX");
TEST(unlinkat_deallocate) {
_cleanup_free_ char *p = NULL;
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
struct stat st;
assert_se(tempfn_random_child(arg_test_dir, "unlink-deallocation", &p) >= 0);
}
TEST(fsync_directory_of_file) {
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
fd = open_tmpfile_unlinkable(arg_test_dir, O_RDWR);
assert_se(fd >= 0);
}
static void create_binary_file(const char *p, const void *data, size_t l) {
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
fd = open(p, O_CREAT|O_WRONLY|O_EXCL|O_CLOEXEC, 0600);
assert_se(fd >= 0);
}
TEST(open_mkdir_at) {
- _cleanup_close_ int fd = -1, subdir_fd = -1, subsubdir_fd = -1;
+ _cleanup_close_ int fd = -EBADF, subdir_fd = -EBADF, subsubdir_fd = -EBADF;
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
assert_se(open_mkdir_at(AT_FDCWD, "/proc", O_EXCL|O_CLOEXEC, 0) == -EEXIST);
TEST(openat_report_new) {
_cleanup_free_ char *j = NULL;
_cleanup_(rm_rf_physical_and_freep) char *d = NULL;
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
bool b;
assert_se(mkdtemp_malloc(NULL, &d) >= 0);