#203 closed defect (worksforme)
fwrite cannot handle more than 4095 chars.
| Reported by: | Tomas Brambora | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 0.4.2 |
| Component: | helenos/lib/c | Version: | mainline |
| Keywords: | Cc: | ||
| Blocker for: | Depends on: | ||
| See also: |
Description
fwrite sets ferror to 1 when attempting to write > 4095 chars. This should not be caused by reaching DATA_XFER_LIMIT as this is set to 64KB.
#include <stdio.h>
#include <errno.h>
#include <vfs/vfs.h>
#include <fcntl.h>
#define BUFSIZE 5000
int main(int argc, char **argv)
{
int i;
char buffer[BUFSIZE];
for (i=0; i<BUFSIZE; ++i)
buffer[i] = 'a';
FILE *f = fopen("/data/tmp", "w");
errno = 0;
printf("ferror: %i\n", ferror(f));
int cnt = fwrite(buffer, sizeof(char), BUFSIZE, f);
printf("cnt: %i, errno: %i, ferror: %i", cnt, errno, ferror(f));
fclose(f);
return 0;
}
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
I am closing this because in my case the reproducible test case is caused by a too small root file system.
comment:3 by , 16 years ago
| Component: | srv/vfs → uspace/libc |
|---|
Note:
See TracTickets
for help on using tickets.

Are you sure you have enough free space on the file system? Root FAT fs has less than 4 kB of free space.