selftests: Testing a write attempt into a full file?

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

 



Hello,

I have constructed another demonstration program.


#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	FILE *f = fopen("/dev/full", "a");

	if (!f)
		goto report_failure;

	{
	int const c = 'X';

	if (fputc(c, f) != c)
		goto report_failure;
	}

	return EXIT_SUCCESS;

report_failure:
	perror(__func__);
	return errno;
}


I got the following result.

elfring@Sonne:~/Projekte/selftests> gcc-7 putc_into_full_file1.c && ./a.out; echo $?
0


Does such a simple test example need further software development considerations?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux