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