#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

#ifdef RCSID
RCSID("$Id: write-ro-file.c,v 1.2 1998/11/19 16:47:53 assar Exp $");
#endif

int
main(int argc, char *argv[])
{
  int fd;
  int ret;

  fd = open("foo", O_RDWR|O_CREAT, 0);
  if (fd == -1) {
    perror("open");
    exit(1);
  }
  ret = write (fd, "foo", 3);
  if (ret == -1) {
      unlink("foo");
      perror("write");
      exit(1);
  }
  ret = close (fd);
  if (ret == -1) {
      unlink("foo");
      perror("close");
      exit(1);
  }
  unlink("foo");
  return 0;
}
