lkml.org 
[lkml]   [2017]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectselftests: Testing a write attempt into a full file?
Date
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

\
 
 \ /
  Last update: 2017-12-03 21:47    [W:1.125 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site