tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NFS over-quota not detected if utimes() called before fsync()/close()
> The attached program [...]
wasn't actually.
#include <unistd.h>
#include <err.h>
#include <fcntl.h>
#include <sys/time.h>
int main(int argc, char *argv[]) {
int fd;
if (argc != 2) errx(1, "argc");
if (!*argv[1]) errx(1, "argv");
if ((fd = open(argv[1], O_RDWR | O_CREAT, 0666)) < 0) err(1, "open");
if (write(fd, &fd, 1) != 1) err(1, "write");
#ifdef UTIMES
if (utimes(argv[1], NULL) < 0) err(1, "utimes");
#endif
#ifdef FUTIMES
if (futimes(fd, NULL) < 0) err(1, "futimes");
#endif
#ifdef FSYNC
if (fsync(fd) < 0) err(1, "fsync");
#endif
if (close(fd) < 0) err(1, "close");
}
Home |
Main Index |
Thread Index |
Old Index