Lines Matching full:rc
224 int rc = write(cap_fd, "OK!\n", 4); in FORK_TEST() local
225 EXPECT_OK(rc); in FORK_TEST()
226 EXPECT_EQ(4, rc); in FORK_TEST()
558 int rc = fcntl(cap_fd, F_GETFL); in TryFileOps() local
559 CHECK_RIGHT_RESULT(rc, rights, CAP_FCNTL); in TryFileOps()
560 rc = fcntl(cap_fd, F_SETFL, rc); in TryFileOps()
561 CHECK_RIGHT_RESULT(rc, rights, CAP_FCNTL); in TryFileOps()
686 int rc = openat(dfd_cap, "cap_create", O_CREAT | O_RDONLY, 0600); in TryDirOps() local
687 CHECK_RIGHT_RESULT(rc, rights, CAP_CREATE, CAP_READ, CAP_LOOKUP); in TryDirOps()
688 if (rc >= 0) { in TryDirOps()
689 EXPECT_OK(close(rc)); in TryDirOps()
692 rc = openat(dfd_cap, "cap_create", O_CREAT | O_WRONLY | O_APPEND, 0600); in TryDirOps()
693 CHECK_RIGHT_RESULT(rc, rights, CAP_CREATE, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
694 if (rc >= 0) { in TryDirOps()
695 EXPECT_OK(close(rc)); in TryDirOps()
698 rc = openat(dfd_cap, "cap_create", O_CREAT | O_RDWR | O_APPEND, 0600); in TryDirOps()
699 CHECK_RIGHT_RESULT(rc, rights, CAP_CREATE, CAP_READ, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
700 if (rc >= 0) { in TryDirOps()
701 EXPECT_OK(close(rc)); in TryDirOps()
705 rc = openat(dirfd, "cap_faccess", O_CREAT, 0600); in TryDirOps()
706 EXPECT_OK(rc); in TryDirOps()
707 EXPECT_OK(close(rc)); in TryDirOps()
708 rc = faccessat(dfd_cap, "cap_faccess", F_OK, 0); in TryDirOps()
709 CHECK_RIGHT_RESULT(rc, rights, CAP_FSTAT, CAP_LOOKUP); in TryDirOps()
712 rc = openat(dirfd, "cap_fsync", O_CREAT, 0600); in TryDirOps()
713 EXPECT_OK(rc); in TryDirOps()
714 EXPECT_OK(close(rc)); in TryDirOps()
715 rc = openat(dfd_cap, "cap_fsync", O_FSYNC | O_RDONLY); in TryDirOps()
716 CHECK_RIGHT_RESULT(rc, rights, CAP_FSYNC, CAP_READ, CAP_LOOKUP); in TryDirOps()
717 if (rc >= 0) { in TryDirOps()
718 EXPECT_OK(close(rc)); in TryDirOps()
720 rc = openat(dfd_cap, "cap_fsync", O_FSYNC | O_WRONLY | O_APPEND); in TryDirOps()
721 CHECK_RIGHT_RESULT(rc, rights, CAP_FSYNC, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
722 if (rc >= 0) { in TryDirOps()
723 EXPECT_OK(close(rc)); in TryDirOps()
725 rc = openat(dfd_cap, "cap_fsync", O_FSYNC | O_RDWR | O_APPEND); in TryDirOps()
726 CHECK_RIGHT_RESULT(rc, rights, CAP_FSYNC, CAP_READ, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
727 if (rc >= 0) { in TryDirOps()
728 EXPECT_OK(close(rc)); in TryDirOps()
730 rc = openat(dfd_cap, "cap_fsync", O_SYNC | O_RDONLY); in TryDirOps()
731 CHECK_RIGHT_RESULT(rc, rights, CAP_FSYNC, CAP_READ, CAP_LOOKUP); in TryDirOps()
732 if (rc >= 0) { in TryDirOps()
733 EXPECT_OK(close(rc)); in TryDirOps()
735 rc = openat(dfd_cap, "cap_fsync", O_SYNC | O_WRONLY | O_APPEND); in TryDirOps()
736 CHECK_RIGHT_RESULT(rc, rights, CAP_FSYNC, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
737 if (rc >= 0) { in TryDirOps()
738 EXPECT_OK(close(rc)); in TryDirOps()
740 rc = openat(dfd_cap, "cap_fsync", O_SYNC | O_RDWR | O_APPEND); in TryDirOps()
741 CHECK_RIGHT_RESULT(rc, rights, CAP_FSYNC, CAP_READ, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
742 if (rc >= 0) { in TryDirOps()
743 EXPECT_OK(close(rc)); in TryDirOps()
747 rc = openat(dirfd, "cap_ftruncate", O_CREAT, 0600); in TryDirOps()
748 EXPECT_OK(rc); in TryDirOps()
749 EXPECT_OK(close(rc)); in TryDirOps()
750 rc = openat(dfd_cap, "cap_ftruncate", O_TRUNC | O_RDONLY); in TryDirOps()
751 CHECK_RIGHT_RESULT(rc, rights, CAP_FTRUNCATE, CAP_READ, CAP_LOOKUP); in TryDirOps()
752 if (rc >= 0) { in TryDirOps()
753 EXPECT_OK(close(rc)); in TryDirOps()
755 rc = openat(dfd_cap, "cap_ftruncate", O_TRUNC | O_WRONLY); in TryDirOps()
756 CHECK_RIGHT_RESULT(rc, rights, CAP_FTRUNCATE, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
757 if (rc >= 0) { in TryDirOps()
758 EXPECT_OK(close(rc)); in TryDirOps()
760 rc = openat(dfd_cap, "cap_ftruncate", O_TRUNC | O_RDWR); in TryDirOps()
761 CHECK_RIGHT_RESULT(rc, rights, CAP_FTRUNCATE, CAP_READ, CAP_WRITE, CAP_LOOKUP); in TryDirOps()
762 if (rc >= 0) { in TryDirOps()
763 EXPECT_OK(close(rc)); in TryDirOps()
767 rc = openat(dfd_cap, "cap_create", O_CREAT | O_WRONLY, 0600); in TryDirOps()
768 CHECK_RIGHT_RESULT(rc, rights, CAP_CREATE, CAP_WRITE, CAP_SEEK, CAP_LOOKUP); in TryDirOps()
769 if (rc >= 0) { in TryDirOps()
770 EXPECT_OK(close(rc)); in TryDirOps()
773 rc = openat(dfd_cap, "cap_create", O_CREAT | O_RDWR, 0600); in TryDirOps()
774 CHECK_RIGHT_RESULT(rc, rights, CAP_CREATE, CAP_READ, CAP_WRITE, CAP_SEEK, CAP_LOOKUP); in TryDirOps()
775 if (rc >= 0) { in TryDirOps()
776 EXPECT_OK(close(rc)); in TryDirOps()
780 rc = openat(dirfd, "cap_fsync", O_CREAT, 0600); in TryDirOps()
781 EXPECT_OK(rc); in TryDirOps()
782 EXPECT_OK(close(rc)); in TryDirOps()
783 rc = openat(dfd_cap, "cap_fsync", O_FSYNC | O_WRONLY); in TryDirOps()
784 CHECK_RIGHT_RESULT(rc, in TryDirOps()
786 if (rc >= 0) { in TryDirOps()
787 EXPECT_OK(close(rc)); in TryDirOps()
789 rc = openat(dfd_cap, "cap_fsync", O_FSYNC | O_RDWR); in TryDirOps()
790 CHECK_RIGHT_RESULT(rc, in TryDirOps()
792 if (rc >= 0) { in TryDirOps()
793 EXPECT_OK(close(rc)); in TryDirOps()
795 rc = openat(dfd_cap, "cap_fsync", O_SYNC | O_WRONLY); in TryDirOps()
796 CHECK_RIGHT_RESULT(rc, in TryDirOps()
798 if (rc >= 0) { in TryDirOps()
799 EXPECT_OK(close(rc)); in TryDirOps()
801 rc = openat(dfd_cap, "cap_fsync", O_SYNC | O_RDWR); in TryDirOps()
802 CHECK_RIGHT_RESULT(rc, in TryDirOps()
804 if (rc >= 0) { in TryDirOps()
805 EXPECT_OK(close(rc)); in TryDirOps()
810 rc = openat(dirfd, "cap_chflagsat", O_CREAT, 0600); in TryDirOps()
811 EXPECT_OK(rc); in TryDirOps()
812 EXPECT_OK(close(rc)); in TryDirOps()
813 rc = chflagsat(dfd_cap, "cap_chflagsat", UF_NODUMP, 0); in TryDirOps()
814 CHECK_RIGHT_RESULT(rc, rights, CAP_CHFLAGSAT, CAP_LOOKUP); in TryDirOps()
818 rc = openat(dirfd, "cap_fchownat", O_CREAT, 0600); in TryDirOps()
819 EXPECT_OK(rc); in TryDirOps()
820 EXPECT_OK(close(rc)); in TryDirOps()
821 rc = fchownat(dfd_cap, "cap_fchownat", -1, -1, 0); in TryDirOps()
822 CHECK_RIGHT_RESULT(rc, rights, CAP_FCHOWN, CAP_LOOKUP); in TryDirOps()
825 rc = openat(dirfd, "cap_fchmodat", O_CREAT, 0600); in TryDirOps()
826 EXPECT_OK(rc); in TryDirOps()
827 EXPECT_OK(close(rc)); in TryDirOps()
828 rc = fchmodat(dfd_cap, "cap_fchmodat", 0600, 0); in TryDirOps()
829 CHECK_RIGHT_RESULT(rc, rights, CAP_FCHMOD, CAP_LOOKUP); in TryDirOps()
832 rc = openat(dirfd, "cap_fstatat", O_CREAT, 0600); in TryDirOps()
833 EXPECT_OK(rc); in TryDirOps()
834 EXPECT_OK(close(rc)); in TryDirOps()
836 rc = fstatat(dfd_cap, "cap_fstatat", &sb, 0); in TryDirOps()
837 CHECK_RIGHT_RESULT(rc, rights, CAP_FSTAT, CAP_LOOKUP); in TryDirOps()
840 rc = openat(dirfd, "cap_futimesat", O_CREAT, 0600); in TryDirOps()
841 EXPECT_OK(rc); in TryDirOps()
842 EXPECT_OK(close(rc)); in TryDirOps()
843 rc = futimesat(dfd_cap, "cap_futimesat", NULL); in TryDirOps()
844 CHECK_RIGHT_RESULT(rc, rights, CAP_FUTIMES, CAP_LOOKUP); in TryDirOps()
850 rc = openat(dirfd, "cap_linkat_src", O_CREAT, 0600); in TryDirOps()
851 EXPECT_OK(rc); in TryDirOps()
852 EXPECT_OK(close(rc)); in TryDirOps()
854 rc = linkat(dirfd, "cap_linkat_src", dfd_cap, "cap_linkat_dst", 0); in TryDirOps()
855 CHECK_RIGHT_RESULT(rc, rights, CAP_LINKAT_TARGET); in TryDirOps()
856 if (rc >= 0) { in TryDirOps()
860 rc = linkat(dfd_cap, "cap_linkat_src", dirfd, "cap_linkat_dst", 0); in TryDirOps()
861 CHECK_RIGHT_RESULT(rc, rights, CAP_LINKAT_SOURCE); in TryDirOps()
862 if (rc >= 0) { in TryDirOps()
868 rc = mkdirat(dfd_cap, "cap_mkdirat", 0700); in TryDirOps()
869 CHECK_RIGHT_RESULT(rc, rights, CAP_MKDIRAT, CAP_LOOKUP); in TryDirOps()
870 if (rc >= 0) { in TryDirOps()
875 rc = mkfifoat(dfd_cap, "cap_mkfifoat", 0600); in TryDirOps()
876 CHECK_RIGHT_RESULT(rc, rights, CAP_MKFIFOAT, CAP_LOOKUP); in TryDirOps()
877 if (rc >= 0) { in TryDirOps()
883 rc = mknodat(dfd_cap, "cap_mknodat", S_IFCHR | 0600, 0); in TryDirOps()
884 CHECK_RIGHT_RESULT(rc, rights, CAP_MKNODAT, CAP_LOOKUP); in TryDirOps()
885 if (rc >= 0) { in TryDirOps()
893 rc = openat(dirfd, "cap_renameat_src", O_CREAT, 0600); in TryDirOps()
894 EXPECT_OK(rc); in TryDirOps()
895 EXPECT_OK(close(rc)); in TryDirOps()
897 rc = renameat(dirfd, "cap_renameat_src", dfd_cap, "cap_renameat_dst"); in TryDirOps()
898 CHECK_RIGHT_RESULT(rc, rights, CAP_RENAMEAT_TARGET); in TryDirOps()
899 if (rc >= 0) { in TryDirOps()
905 rc = openat(dirfd, "cap_renameat_src", O_CREAT, 0600); in TryDirOps()
906 EXPECT_OK(rc); in TryDirOps()
907 EXPECT_OK(close(rc)); in TryDirOps()
909 rc = renameat(dfd_cap, "cap_renameat_src", dirfd, "cap_renameat_dst"); in TryDirOps()
910 CHECK_RIGHT_RESULT(rc, rights, CAP_RENAMEAT_SOURCE); in TryDirOps()
912 if (rc >= 0) { in TryDirOps()
918 rc = symlinkat("test", dfd_cap, "cap_symlinkat"); in TryDirOps()
919 CHECK_RIGHT_RESULT(rc, rights, CAP_SYMLINKAT, CAP_LOOKUP); in TryDirOps()
920 if (rc >= 0) { in TryDirOps()
924 rc = openat(dirfd, "cap_unlinkat", O_CREAT, 0600); in TryDirOps()
925 EXPECT_OK(rc); in TryDirOps()
926 EXPECT_OK(close(rc)); in TryDirOps()
927 rc = unlinkat(dfd_cap, "cap_unlinkat", 0); in TryDirOps()
928 CHECK_RIGHT_RESULT(rc, rights, CAP_UNLINKAT, CAP_LOOKUP); in TryDirOps()
931 rc = unlinkat(dfd_cap, "cap_unlinkat", AT_REMOVEDIR); in TryDirOps()
932 CHECK_RIGHT_RESULT(rc, rights, CAP_UNLINKAT, CAP_LOOKUP); in TryDirOps()
939 int rc = mkdir(TmpFile("cap_dirops"), 0755); in DirOperationsTest() local
940 EXPECT_OK(rc); in DirOperationsTest()
941 if (rc < 0 && errno != EEXIST) return; in DirOperationsTest()
993 int rc = write(cap_fd, "", 0); in TryReadWrite() local
994 EXPECT_EQ(-1, rc); in TryReadWrite()
1027 int rc = recvmsg(sock_fds[0], &mh, 0); variable
1028 EXPECT_OK(rc);
1074 int rc = sendmsg(sock_fds[1], &mh, 0); variable
1075 EXPECT_OK(rc);
1085 int rc = mkdir(TmpFile("cap_at_topdir"), 0755); in TEST() local
1086 EXPECT_OK(rc); in TEST()
1087 if (rc < 0 && errno != EEXIST) return; in TEST()
1169 int rc = mkdir(TmpFile("cap_at_topdir"), 0755); in TEST() local
1170 EXPECT_OK(rc); in TEST()
1171 if (rc < 0 && errno != EEXIST) return; in TEST()
1218 int rc = fgetxattr_(fd, "user.capsicumtest", buffer, sizeof(buffer)); variable
1219 if (rc < 0 && errno == ENOTSUP) {
1330 int rc = fchmod(fd, 0666); in TEST() local
1331 EXPECT_EQ(-1, rc); in TEST()