[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

zero write in jffs(1)



Calling jffs_file_write() in inode-v23.c with a count of zero will result in a EINVAL. This behaviour must be wrong. I'm using JFFS from Linux 2.4.3 and _not_ the current CVS. Has this been fixed in current CVS? Otherwise I guess someone ought to add a

if (!count) {
	return 0;
}

somewhere at the beginning of jffs_file_write().


The simple test below failes and says:

errno: 22
write: Invalid argument

but it shouldn't right?


#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
	int fd;

	if ((fd = open(argv[1], O_CREAT | O_WRONLY, 0644)) < 0) {
		fprintf(stderr, "errno: %d\n", errno);
		perror("open");
		return 1;
	}

	if (write(fd, "", 0) < 0) {
		fprintf(stderr, "errno: %d\n", errno);
		perror("write");
	}

	close(fd);

	return 0;
}

/Jonas

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com