home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!unido!marco!krabat!leo
- From: leo@krabat.marco.de (Matthias Pfaller)
- Newsgroups: comp.unix.internals
- Subject: Problems with fsync(2) in SunOS
- Keywords: fsync EACCES
- Message-ID: <1089@krabat.marco.de>
- Date: 31 Jul 92 08:46:58 GMT
- Organization: marco GmbH, D-8047 Karlsfeld
- Lines: 59
-
- We have a network of three sun-machines (one of them with SunOS 4.1.2,
- the other two with SunOS 4.1.1) and four SysVr3 machines (one 386-based,
- three M68020-based). The filesystems are crossmounted with NFS.
-
- We are using SCCS to maintain our sources.
- We noticed that when one does a delta from a sun on a directory mounted
- from a SysVr3 machine, the delta command fails with
- "directory `.' unwritable"
- also the directory IS writable.
- using trace(1) we could identify the failing systemcall. It's "fsync(2)".
-
- You can use the following small c-program to reproduce the problem.
- Requirments:
- You need root-access on your own machine.
- You need root-access on the remote machine.
- You must not be logged in as root or bin.
-
- execute the command with:
- tst remote-filesys/file
-
- It is important that the chown that is done with a call to system(3)
- succeeds. If your remote machine is a SysV machine you may insert
- if (fchown(1, 2, -1))
- perror("fchown");
- instead of the call to system(3).
-
- The fsync-call will fail with EACCES.
- If you try the program on a local file, there will be no problem.
- Has anyone a solution for our problem?
-
- Matthias Pfaller (leo @ marco.de)
-
- #include <fcntl.h>
-
- main(argc, argv)
- int argc; char **argv;
- {
- int fd;
- char b[80];
-
- if ((fd = open(argv[1], O_WRONLY|O_CREAT, 0666)) < 0) {
- perror("open");
- exit(1);
- }
-
- if (fchmod(fd, 0444))
- perror("fchmod");
-
- sprintf(b, "su root -c '/etc/chown bin %s'", argv[1]);
- system(b);
-
- if (write(fd, "hallo\n", 6) != 6)
- perror("write");
- if (fsync(fd))
- perror("fsync");
- if (close(fd))
- perror("close");
- exit(0);
- }
-