Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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 Changed 10 years ago by Jiri Svoboda

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

comment:2 Changed 10 years ago by Jakub Jermář

Resolution: worksforme
Status: newclosed

I am closing this because in my case the reproducible test case is caused by a too small root file system.

comment:3 Changed 10 years ago by Jakub Jermář

Component: srv/vfsuspace/libc
Note: See TracTickets for help on using tickets.