Messages in this thread | | | From | "Paradox" <> | Subject | Undefined behavior? Or just a feature? | Date | Sat, 14 Aug 1999 06:59:58 -0400 |
| |
I seem to be able to create files in linux that are 2+ gigs when there is only 100 MB free...infact I can create dozens of them without problem, and the disk usage shown by "df" is unaffected, and "du" reports only 4 blocks on the files. Heres the code that does it :
#include <stdio.h> #include <stdlib.h>
#define FILESIZE 2000000000
int main(int argc, char **argv) { FILE *bf; if (argc != 2) { fprintf(stderr, "Syntax: %s filename\n", *argv); return 1; } bf = fopen(argv[1], "w+"); if (!bf) { perror("fopen"); return 2; }
fseek(bf, FILESIZE, SEEK_SET); fputc('?', bf); fclose(bf); printf("Done\n"); return 0; }
(there may be errors, I just typed in this in the message and didn't compile it, but you get the idea)
Regards, Dave (paradox@maine.rr.com)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |