#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>

int main() {
  int r;

  setregid(-1, 501);
  setreuid(-1, 501);

  r = open("foo", O_CREAT, S_IRWXU);
  if (r < 0) {
    perror("open");
  }
  return 0;
}

