DF-3092 / trigger3092.c
/* DF-3092: single 3584-byte append to BIG.TXT (7 clusters wanted, * only 6 real ones remain). One write(2) so msdosfs_write computes * count = 7 and calls extendfile(7) -> clusteralloc(start=40, count=7). */ #include <stdio.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char **argv) { char buf[3584]; ssize_t n; int fd; if (argc != 2) { fprintf(stderr, "usage: %s file\n", argv[0]); return 1; } fd = open(argv[1], O_WRONLY | O_APPEND); if (fd < 0) { perror("open"); return 1; } memset(buf, 'Z', sizeof(buf)); n = write(fd, buf, sizeof(buf)); printf("write(3584) returned %zd", n); if (n < 0) printf(" errno=%d (%s)", errno, strerror(errno)); printf("\n"); if (n >= 3073) { /* 6 real clusters = 3072 bytes max */ printf("UNEXPECTED: more than 6 clusters' worth accepted\n"); } return 0; } |